Shanvi1 / app.py
SUDHARANJAN's picture
Update app.py
cac77cf verified
raw
history blame contribute delete
707 Bytes
import os
import gradio as gr
from transformers import pipeline
# Fetch Hugging Face token from secrets
hf_token = os.getenv("HF_TOKEN")
# Explicitly pass the token while loading
tts = pipeline(
"text-to-speech",
model="ai4bharat/IndicF5",
use_auth_token=hf_token
)
def generate_audio(text):
result = tts(text)
return (22050, result["audio"])
demo = gr.Interface(
fn=generate_audio,
inputs=gr.Textbox(label="Enter Odia Text", placeholder="ଓଡ଼ିଆରେ ଟେକ୍ସଟ୍ ଲେଖନ୍ତୁ"),
outputs=gr.Audio(label="Generated Speech"),
title="Open Odia TTS",
description="Type Odia text and listen. Powered by AI4Bharat IndicF5."
)
demo.launch()