Spaces:
Sleeping
Sleeping
Added rtc_configuration
Browse files- requirements.txt +2 -1
- src/app.py +23 -1
requirements.txt
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
fastrtc
|
2 |
fastrtc[vad]
|
3 |
openpyxl
|
4 |
-
protobuf
|
|
|
5 |
scipy
|
6 |
sentencepiece
|
7 |
torchaudio
|
|
|
1 |
fastrtc
|
2 |
fastrtc[vad]
|
3 |
openpyxl
|
4 |
+
protobuf
|
5 |
+
python-dotenv
|
6 |
scipy
|
7 |
sentencepiece
|
8 |
torchaudio
|
src/app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from pathlib import Path
|
2 |
|
3 |
import pandas as pd
|
@@ -8,10 +10,26 @@ import numpy as np
|
|
8 |
|
9 |
import gradio as gr
|
10 |
|
11 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
from transformers import AutoProcessor, SeamlessM4Tv2Model
|
13 |
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
parent_dir = Path(__file__).parents[1]
|
16 |
config_path = Path(parent_dir, "configs")
|
17 |
|
@@ -179,6 +197,10 @@ with gr.Blocks(
|
|
179 |
modality="audio",
|
180 |
mode="send-receive",
|
181 |
label="Audio Stream",
|
|
|
|
|
|
|
|
|
182 |
)
|
183 |
|
184 |
# Trigger on pause
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
from pathlib import Path
|
4 |
|
5 |
import pandas as pd
|
|
|
10 |
|
11 |
import gradio as gr
|
12 |
|
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 |
+
)
|
20 |
from transformers import AutoProcessor, SeamlessM4Tv2Model
|
21 |
|
22 |
|
23 |
+
load_dotenv(override=True)
|
24 |
+
|
25 |
+
# HF_TOKEN
|
26 |
+
HF_TOKEN = os.getenv("HF_TOKEN")
|
27 |
+
|
28 |
+
|
29 |
+
async def get_credentials():
|
30 |
+
return await get_cloudflare_turn_credentials_async(hf_token=HF_TOKEN)
|
31 |
+
|
32 |
+
|
33 |
parent_dir = Path(__file__).parents[1]
|
34 |
config_path = Path(parent_dir, "configs")
|
35 |
|
|
|
197 |
modality="audio",
|
198 |
mode="send-receive",
|
199 |
label="Audio Stream",
|
200 |
+
rtc_configuration=get_credentials,
|
201 |
+
server_rtc_configuration=get_cloudflare_turn_credentials(
|
202 |
+
ttl=360_000
|
203 |
+
),
|
204 |
)
|
205 |
|
206 |
# Trigger on pause
|