freddyaboulton HF Staff commited on
Commit
5738222
·
verified ·
1 Parent(s): debbc88

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. README.md +7 -4
  2. app.py +10 -1
  3. requirements.txt +3 -0
README.md CHANGED
@@ -1,12 +1,15 @@
1
  ---
2
  title: Echo Audio
3
- emoji: 😻
4
- colorFrom: red
5
- colorTo: purple
6
  sdk: gradio
7
  sdk_version: 5.16.0
8
  app_file: app.py
9
  pinned: false
 
 
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Echo Audio
3
+ emoji: 🪩
4
+ colorFrom: purple
5
+ colorTo: red
6
  sdk: gradio
7
  sdk_version: 5.16.0
8
  app_file: app.py
9
  pinned: false
10
+ license: mit
11
+ short_description: Simple echo stream - simplest FastRTC demo
12
+ tags: [webrtc, websocket, gradio, secret|TWILIO_ACCOUNT_SID, secret|TWILIO_AUTH_TOKEN]
13
  ---
14
 
15
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -1,4 +1,6 @@
1
- from fastrtc import Stream, ReplyOnPause
 
 
2
  import numpy as np
3
 
4
 
@@ -12,9 +14,16 @@ stream = Stream(
12
  handler=ReplyOnPause(detection),
13
  modality="audio",
14
  mode="send-receive",
 
 
15
  )
16
 
17
 
 
 
 
 
 
18
  if __name__ == "__main__":
19
  import uvicorn
20
 
 
1
+ from fastrtc import Stream, ReplyOnPause, get_twilio_turn_credentials
2
+ from fastapi.responses import RedirectResponse
3
+ from gradio.utils import get_space
4
  import numpy as np
5
 
6
 
 
14
  handler=ReplyOnPause(detection),
15
  modality="audio",
16
  mode="send-receive",
17
+ rtc_configuration=get_twilio_turn_credentials() if get_space() else None,
18
+ concurrency_limit=20 if get_space() else None,
19
  )
20
 
21
 
22
+ @stream.get("/")
23
+ async def index():
24
+ return RedirectResponse(url="/ui")
25
+
26
+
27
  if __name__ == "__main__":
28
  import uvicorn
29
 
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fastrtc[vad]
2
+ twilio
3
+ python-dotenv