Spaces:
Paused
Paused
| import gradio as gr | |
| import requests | |
| import base64 | |
| import io | |
| API_URL = "http://localhost:8000" # вътрешно | |
| def synthesize(text, speed): | |
| response = requests.post( | |
| f"{API_URL}/api/v1/synthesize", | |
| json={"text": text, "voice_style": "F5", "speed": speed} | |
| ) | |
| audio_bytes = io.BytesIO(response.content) | |
| return audio_bytes | |
| with gr.Blocks(title="Ani Voice API - Bulgarian TTS") as demo: | |
| gr.Markdown("# 🎙️ Ani Voice API\nБългарски TTS модел") | |
| with gr.Row(): | |
| text_input = gr.Textbox(label="Текст", placeholder="Въведете текст на български...") | |
| speed_slider = gr.Slider(0.5, 2.0, value=1.6, label="Скорост") | |
| audio_output = gr.Audio(label="Генериран звук", type="numpy") | |
| btn = gr.Button("Синтезирай", variant="primary") | |
| btn.click(synthesize, inputs=[text_input, speed_slider], outputs=audio_output) | |
| demo.launch() |