File size: 764 Bytes
df4d1dd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
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() |