blasisd commited on
Commit
2a3432f
·
1 Parent(s): e6bcabc

Changed turn credentials' retrieval

Browse files
Files changed (1) hide show
  1. src/app.py +13 -9
src/app.py CHANGED
@@ -1,4 +1,3 @@
1
- import asyncio
2
  import os
3
 
4
  from pathlib import Path
@@ -14,7 +13,7 @@ import gradio as gr
14
  from dotenv import load_dotenv
15
  from fastrtc import (
16
  get_cloudflare_turn_credentials_async,
17
- get_cloudflare_turn_credentials,
18
  WebRTC,
19
  ReplyOnPause,
20
  )
@@ -24,6 +23,14 @@ from transformers import AutoProcessor, SeamlessM4Tv2Model
24
 
25
  load_dotenv(override=True)
26
 
 
 
 
 
 
 
 
 
27
  parent_dir = Path(__file__).parents[1]
28
  config_path = Path(parent_dir, "configs")
29
 
@@ -187,17 +194,14 @@ with gr.Blocks(
187
  )
188
 
189
  with gr.Column(scale=5, elem_id="micCol"):
190
- rtc_credentials = (
191
- asyncio.run(get_cloudflare_turn_credentials_async())
192
- if get_space()
193
- else None
194
- )
195
-
196
  audio = WebRTC(
197
  modality="audio",
198
  mode="send-receive",
199
  label="Audio Stream",
200
- rtc_configuration=rtc_credentials,
 
 
 
201
  # server_rtc_configuration=get_cloudflare_turn_credentials(
202
  # ttl=360_000
203
  # ),
 
 
1
  import os
2
 
3
  from pathlib import Path
 
13
  from dotenv import load_dotenv
14
  from fastrtc import (
15
  get_cloudflare_turn_credentials_async,
16
+ # get_cloudflare_turn_credentials,
17
  WebRTC,
18
  ReplyOnPause,
19
  )
 
23
 
24
  load_dotenv(override=True)
25
 
26
+ # # HF_TOKEN
27
+ # HF_TOKEN = os.getenv("HF_TOKEN")
28
+
29
+
30
+ # async def get_credentials():
31
+ # return await get_cloudflare_turn_credentials_async(hf_token=HF_TOKEN)
32
+
33
+
34
  parent_dir = Path(__file__).parents[1]
35
  config_path = Path(parent_dir, "configs")
36
 
 
194
  )
195
 
196
  with gr.Column(scale=5, elem_id="micCol"):
 
 
 
 
 
 
197
  audio = WebRTC(
198
  modality="audio",
199
  mode="send-receive",
200
  label="Audio Stream",
201
+ rtc_configuration=(
202
+ get_cloudflare_turn_credentials_async if get_space() else None
203
+ ),
204
+ # rtc_configuration=get_credentials,
205
  # server_rtc_configuration=get_cloudflare_turn_credentials(
206
  # ttl=360_000
207
  # ),