Spaces:
Sleeping
Sleeping
Changed turn credentials' retrieval
Browse files- src/app.py +9 -3
src/app.py
CHANGED
|
@@ -12,8 +12,9 @@ import gradio as gr
|
|
| 12 |
|
| 13 |
from dotenv import load_dotenv
|
| 14 |
from fastrtc import (
|
|
|
|
| 15 |
get_cloudflare_turn_credentials_async,
|
| 16 |
-
|
| 17 |
WebRTC,
|
| 18 |
ReplyOnPause,
|
| 19 |
)
|
|
@@ -198,12 +199,18 @@ with gr.Blocks(
|
|
| 198 |
elem_id="langDropdown",
|
| 199 |
)
|
| 200 |
|
|
|
|
|
|
|
| 201 |
with gr.Column(scale=5, elem_id="micCol"):
|
| 202 |
audio = WebRTC(
|
| 203 |
modality="audio",
|
| 204 |
mode="send-receive",
|
| 205 |
label="Audio Stream",
|
| 206 |
-
rtc_configuration=(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
# rtc_configuration=get_credentials,
|
| 208 |
# server_rtc_configuration=get_cloudflare_turn_credentials(
|
| 209 |
# ttl=360_000
|
|
@@ -216,7 +223,6 @@ with gr.Blocks(
|
|
| 216 |
inputs=[audio, target_lang],
|
| 217 |
outputs=[audio],
|
| 218 |
concurrency_limit=5 if get_space() else None,
|
| 219 |
-
time_limit=90 if get_space() else None,
|
| 220 |
)
|
| 221 |
|
| 222 |
# Sticky footer (will stay at bottom on all screen sizes)
|
|
|
|
| 12 |
|
| 13 |
from dotenv import load_dotenv
|
| 14 |
from fastrtc import (
|
| 15 |
+
Stream,
|
| 16 |
get_cloudflare_turn_credentials_async,
|
| 17 |
+
get_cloudflare_turn_credentials,
|
| 18 |
WebRTC,
|
| 19 |
ReplyOnPause,
|
| 20 |
)
|
|
|
|
| 199 |
elem_id="langDropdown",
|
| 200 |
)
|
| 201 |
|
| 202 |
+
print(get_cloudflare_turn_credentials(ttl=360_000))
|
| 203 |
+
|
| 204 |
with gr.Column(scale=5, elem_id="micCol"):
|
| 205 |
audio = WebRTC(
|
| 206 |
modality="audio",
|
| 207 |
mode="send-receive",
|
| 208 |
label="Audio Stream",
|
| 209 |
+
rtc_configuration=(
|
| 210 |
+
get_cloudflare_turn_credentials(ttl=360_000)
|
| 211 |
+
if get_space()
|
| 212 |
+
else None
|
| 213 |
+
), # (get_turn_config if get_space() else None),
|
| 214 |
# rtc_configuration=get_credentials,
|
| 215 |
# server_rtc_configuration=get_cloudflare_turn_credentials(
|
| 216 |
# ttl=360_000
|
|
|
|
| 223 |
inputs=[audio, target_lang],
|
| 224 |
outputs=[audio],
|
| 225 |
concurrency_limit=5 if get_space() else None,
|
|
|
|
| 226 |
)
|
| 227 |
|
| 228 |
# Sticky footer (will stay at bottom on all screen sizes)
|