Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload folder using huggingface_hub
Browse files- app.py +18 -12
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
-
|
|
|
|
|
2 |
|
3 |
-
import
|
4 |
import gradio as gr
|
5 |
-
|
6 |
-
from
|
7 |
-
from
|
8 |
-
from pathlib import Path
|
9 |
from fastapi.responses import HTMLResponse, StreamingResponse
|
|
|
|
|
|
|
10 |
from groq import Groq
|
11 |
-
import anthropic
|
12 |
-
from elevenlabs import ElevenLabs
|
13 |
-
import os
|
14 |
from pydantic import BaseModel
|
15 |
-
import json
|
16 |
|
17 |
load_dotenv()
|
18 |
|
@@ -69,6 +69,7 @@ stream = Stream(
|
|
69 |
additional_inputs=[chatbot],
|
70 |
additional_outputs=[chatbot],
|
71 |
rtc_configuration=get_twilio_turn_credentials() if get_space() else None,
|
|
|
72 |
)
|
73 |
|
74 |
|
@@ -108,6 +109,11 @@ def _(webrtc_id: str):
|
|
108 |
|
109 |
|
110 |
if __name__ == "__main__":
|
111 |
-
import
|
|
|
|
|
|
|
112 |
|
113 |
-
|
|
|
|
|
|
1 |
+
import json
|
2 |
+
import os
|
3 |
+
from pathlib import Path
|
4 |
|
5 |
+
import anthropic
|
6 |
import gradio as gr
|
7 |
+
import numpy as np
|
8 |
+
from dotenv import load_dotenv
|
9 |
+
from elevenlabs import ElevenLabs
|
|
|
10 |
from fastapi.responses import HTMLResponse, StreamingResponse
|
11 |
+
from fastrtc import AdditionalOutputs, ReplyOnPause, Stream, get_twilio_turn_credentials
|
12 |
+
from fastrtc.utils import aggregate_bytes_to_16bit, audio_to_bytes
|
13 |
+
from gradio.utils import get_space
|
14 |
from groq import Groq
|
|
|
|
|
|
|
15 |
from pydantic import BaseModel
|
|
|
16 |
|
17 |
load_dotenv()
|
18 |
|
|
|
69 |
additional_inputs=[chatbot],
|
70 |
additional_outputs=[chatbot],
|
71 |
rtc_configuration=get_twilio_turn_credentials() if get_space() else None,
|
72 |
+
concurrency_limit=20 if get_space() else None,
|
73 |
)
|
74 |
|
75 |
|
|
|
109 |
|
110 |
|
111 |
if __name__ == "__main__":
|
112 |
+
import os
|
113 |
+
|
114 |
+
if not os.getenv("PHONE"):
|
115 |
+
import uvicorn
|
116 |
|
117 |
+
s = uvicorn.run(stream, host="0.0.0.0", port=7860)
|
118 |
+
else:
|
119 |
+
stream.fastphone(host="0.0.0.0", port=7860)
|
requirements.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
fastrtc[vad]
|
2 |
elevenlabs
|
3 |
groq
|
4 |
anthropic
|
|
|
1 |
+
fastrtc[vad]
|
2 |
elevenlabs
|
3 |
groq
|
4 |
anthropic
|