|
import gradio as gr |
|
import os |
|
import sys |
|
from Zonos_main.tts import ZonosTTS |
|
|
|
|
|
tts = ZonosTTS() |
|
|
|
def generate_audio(text): |
|
try: |
|
|
|
output_path = "output.wav" |
|
|
|
|
|
tts.generate(text, output_path) |
|
|
|
|
|
return output_path |
|
except Exception as e: |
|
raise gr.Error(f"Audio generation failed: {str(e)}") |
|
|
|
|
|
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" |
|
) |
|
|
|
|
|
demo.launch() |