Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ from fastrtc import (
|
|
| 13 |
AdditionalOutputs,
|
| 14 |
AsyncStreamHandler,
|
| 15 |
Stream,
|
| 16 |
-
|
| 17 |
wait_for_item,
|
| 18 |
)
|
| 19 |
from gradio.utils import get_space
|
|
@@ -109,7 +109,7 @@ stream.mount(app)
|
|
| 109 |
|
| 110 |
@app.get("/")
|
| 111 |
async def _():
|
| 112 |
-
rtc_config =
|
| 113 |
html_content = (cur_dir / "index.html").read_text()
|
| 114 |
html_content = html_content.replace("__RTC_CONFIGURATION__", json.dumps(rtc_config))
|
| 115 |
return HTMLResponse(content=html_content)
|
|
|
|
| 13 |
AdditionalOutputs,
|
| 14 |
AsyncStreamHandler,
|
| 15 |
Stream,
|
| 16 |
+
get_cloudflare_turn_credentials_async,
|
| 17 |
wait_for_item,
|
| 18 |
)
|
| 19 |
from gradio.utils import get_space
|
|
|
|
| 109 |
|
| 110 |
@app.get("/")
|
| 111 |
async def _():
|
| 112 |
+
rtc_config = await get_cloudflare_turn_credentials_async() if get_space() else None
|
| 113 |
html_content = (cur_dir / "index.html").read_text()
|
| 114 |
html_content = html_content.replace("__RTC_CONFIGURATION__", json.dumps(rtc_config))
|
| 115 |
return HTMLResponse(content=html_content)
|