Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,8 @@ API_URL_ROBERTA = "https://api-inference.huggingface.co/models/deepset/roberta-b
|
|
10 |
API_URL_TTS = "https://api-inference.huggingface.co/models/espnet/english_male_ryanspeech_tacotron"
|
11 |
API_URL_WHISPER = "https://api-inference.huggingface.co/models/openai/whisper-large-v2"
|
12 |
|
13 |
-
# Hugging Face API Token
|
14 |
-
API_TOKEN = os.getenv("
|
15 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
16 |
|
17 |
# Retry settings
|
@@ -30,7 +30,7 @@ def query_whisper(audio_path):
|
|
30 |
with open(audio_path, "rb") as f:
|
31 |
data = f.read()
|
32 |
|
33 |
-
response = requests.post(API_URL_WHISPER, headers=HEADERS,
|
34 |
response.raise_for_status()
|
35 |
return response.json()
|
36 |
|
@@ -130,4 +130,4 @@ iface = gr.Interface(
|
|
130 |
)
|
131 |
|
132 |
# Launch the Gradio app
|
133 |
-
iface.launch()
|
|
|
10 |
API_URL_TTS = "https://api-inference.huggingface.co/models/espnet/english_male_ryanspeech_tacotron"
|
11 |
API_URL_WHISPER = "https://api-inference.huggingface.co/models/openai/whisper-large-v2"
|
12 |
|
13 |
+
# Hugging Face API Token
|
14 |
+
API_TOKEN = os.getenv("HF_API_KEY") # Ensure you have set this environment variable
|
15 |
HEADERS = {"Authorization": f"Bearer {API_TOKEN}"}
|
16 |
|
17 |
# Retry settings
|
|
|
30 |
with open(audio_path, "rb") as f:
|
31 |
data = f.read()
|
32 |
|
33 |
+
response = requests.post(API_URL_WHISPER, headers=HEADERS, files={"file": data})
|
34 |
response.raise_for_status()
|
35 |
return response.json()
|
36 |
|
|
|
130 |
)
|
131 |
|
132 |
# Launch the Gradio app
|
133 |
+
iface.launch(share=True)
|