Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from pipeline import voice_to_voice
|
| 4 |
+
|
| 5 |
+
with gr.Blocks(title="Voice to Voice AI Assistant") as demo:
|
| 6 |
+
gr.Markdown("## 🎙️ Voice to Voice AI Assistant")
|
| 7 |
+
gr.Markdown("Speak → AI thinks → AI speaks back")
|
| 8 |
+
|
| 9 |
+
audio_input = gr.Audio(
|
| 10 |
+
sources=["microphone"],
|
| 11 |
+
type="filepath",
|
| 12 |
+
label="Speak Here"
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
audio_output = gr.Audio(
|
| 16 |
+
type="filepath",
|
| 17 |
+
label="AI Voice Response"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
text_output = gr.Textbox(label="AI Text Response")
|
| 21 |
+
|
| 22 |
+
btn = gr.Button("Run")
|
| 23 |
+
|
| 24 |
+
btn.click(
|
| 25 |
+
fn=voice_to_voice,
|
| 26 |
+
inputs=audio_input,
|
| 27 |
+
outputs=[audio_output, text_output],
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
demo.launch()
|