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

Changed turn credentials' retrieval

Browse files
Files changed (1) hide show
  1. src/app.py +8 -12
src/app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import os
2
 
3
  from pathlib import Path
@@ -23,14 +24,6 @@ from transformers import AutoProcessor, SeamlessM4Tv2Model
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,14 +187,17 @@ with gr.Blocks(
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
  # ),
 
1
+ import asyncio
2
  import os
3
 
4
  from pathlib import Path
 
24
 
25
  load_dotenv(override=True)
26
 
 
 
 
 
 
 
 
 
27
  parent_dir = Path(__file__).parents[1]
28
  config_path = Path(parent_dir, "configs")
29
 
 
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
  # ),