Podcaster / app.py
Styner1's picture
Update app.py
7ba8e71 verified
raw
history blame
694 Bytes
import gradio as gr
import base64
from Zonos_main.tts import ZonosTTS
# Initialize model ONCE when space starts
tts = ZonosTTS() # <-- MUST WORK WITHOUT ERRORS
def generate_audio(text):
try:
# Generate raw audio bytes (MODIFY THIS TO MATCH YOUR MODEL)
audio_bytes = tts.generate(text) # Should return bytes directly
# Convert to base64
return f"data:audio/wav;base64,{base64.b64encode(audio_bytes).decode('utf-8')}"
except Exception as e:
raise gr.Error(f"TTS Failed: {str(e)}")
# Minimal interface
gr.Interface(
fn=generate_audio,
inputs=gr.Textbox(label="Input"),
outputs=gr.Audio(type="filepath"),
).launch()