Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
|
4 |
+
def respond(audio_input):
|
5 |
+
user_input = transcribe_audio(audio_input)
|
6 |
+
text_response, output_path = generate_response(user_input)
|
7 |
+
|
8 |
+
audio = AudioSegment.from_wav(output_path)
|
9 |
+
duration = len(audio) / 1000
|
10 |
+
|
11 |
+
return text_response, output_path
|
12 |
+
|
13 |
+
gr.Interface(
|
14 |
+
fn=respond,
|
15 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
16 |
+
outputs=["text", "audio"],
|
17 |
+
title="Tommy Vercetti Chatbot",
|
18 |
+
description="Chat with Tommy Vercetti from GTA Vice City. Get responses in both text and voice!"
|
19 |
+
).launch(debug=True)
|