Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
def generate_audio(text):
|
| 8 |
out = tts(text)
|
| 9 |
-
return (22050, out["audio"])
|
| 10 |
|
| 11 |
demo = gr.Interface(
|
| 12 |
fn=generate_audio,
|
| 13 |
inputs=gr.Textbox(label="Enter Odia Text", placeholder="ଓଡ଼ିଆରେ ଟେକ୍ସଟ୍ ଲେଖନ୍ତୁ"),
|
| 14 |
outputs=gr.Audio(label="Generated Speech"),
|
| 15 |
title="Open Odia TTS",
|
| 16 |
-
description="Type
|
| 17 |
)
|
| 18 |
|
| 19 |
demo.launch()
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
+
# Get token from repository secrets
|
| 6 |
+
hf_token = os.getenv("HF_TOKEN")
|
| 7 |
+
|
| 8 |
+
# Load the Odia TTS model
|
| 9 |
+
tts = pipeline(
|
| 10 |
+
"text-to-speech",
|
| 11 |
+
model="ai4bharat/IndicF5",
|
| 12 |
+
use_auth_token=hf_token
|
| 13 |
+
)
|
| 14 |
|
| 15 |
def generate_audio(text):
|
| 16 |
out = tts(text)
|
| 17 |
+
return (22050, out["audio"])
|
| 18 |
|
| 19 |
demo = gr.Interface(
|
| 20 |
fn=generate_audio,
|
| 21 |
inputs=gr.Textbox(label="Enter Odia Text", placeholder="ଓଡ଼ିଆରେ ଟେକ୍ସଟ୍ ଲେଖନ୍ତୁ"),
|
| 22 |
outputs=gr.Audio(label="Generated Speech"),
|
| 23 |
title="Open Odia TTS",
|
| 24 |
+
description="Type Odia text and listen. Powered by AI4Bharat IndicF5."
|
| 25 |
)
|
| 26 |
|
| 27 |
demo.launch()
|