Podcaster / app.py
Styner1's picture
Create app.py
df4d1dd verified
raw
history blame
764 Bytes
import gradio as gr
import os
import sys
from Zonos_main.tts import ZonosTTS # Adjust import path as needed
# Initialize TTS model
tts = ZonosTTS()
def generate_audio(text):
try:
# Generate audio file path
output_path = "output.wav"
# Run TTS
tts.generate(text, output_path)
# Return audio file
return output_path
except Exception as e:
raise gr.Error(f"Audio generation failed: {str(e)}")
# Create Gradio interface
demo = gr.Interface(
fn=generate_audio,
inputs=gr.Textbox(label="Input Text"),
outputs=gr.Audio(label="Generated Speech"),
title="Zonos TTS Service",
description="Convert text to speech using Zonos TTS model"
)
# Launch the app
demo.launch()