File size: 956 Bytes
a6143f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()