Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,10 +2,10 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
-
#
|
| 6 |
hf_token = os.getenv("HF_TOKEN")
|
| 7 |
|
| 8 |
-
#
|
| 9 |
tts = pipeline(
|
| 10 |
"text-to-speech",
|
| 11 |
model="ai4bharat/IndicF5",
|
|
@@ -13,8 +13,8 @@ tts = pipeline(
|
|
| 13 |
)
|
| 14 |
|
| 15 |
def generate_audio(text):
|
| 16 |
-
|
| 17 |
-
return (22050,
|
| 18 |
|
| 19 |
demo = gr.Interface(
|
| 20 |
fn=generate_audio,
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
+
# Fetch Hugging Face token from secrets
|
| 6 |
hf_token = os.getenv("HF_TOKEN")
|
| 7 |
|
| 8 |
+
# Explicitly pass the token while loading
|
| 9 |
tts = pipeline(
|
| 10 |
"text-to-speech",
|
| 11 |
model="ai4bharat/IndicF5",
|
|
|
|
| 13 |
)
|
| 14 |
|
| 15 |
def generate_audio(text):
|
| 16 |
+
result = tts(text)
|
| 17 |
+
return (22050, result["audio"])
|
| 18 |
|
| 19 |
demo = gr.Interface(
|
| 20 |
fn=generate_audio,
|