Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,41 +1,17 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
-
from
|
|
|
3 |
|
4 |
-
# Initialize Flask app
|
5 |
app = Flask(__name__)
|
6 |
|
7 |
-
|
8 |
-
def
|
9 |
-
|
10 |
-
response = "You said: " + input_text
|
11 |
-
return response
|
12 |
|
13 |
-
|
14 |
-
def
|
15 |
-
|
16 |
-
transcription = audio
|
17 |
-
return transcription
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
return chatbot_response(input_text)
|
22 |
-
|
23 |
-
# Define Voice Chat UI
|
24 |
-
def voice_ui(audio):
|
25 |
-
return voice_transcription(audio)
|
26 |
-
|
27 |
-
# Web interface for chatbot
|
28 |
-
gr.Interface(
|
29 |
-
fn=chatbot_ui,
|
30 |
-
inputs=gr.inputs.Textbox(label="Type your message"),
|
31 |
-
outputs=gr.outputs.Textbox(label="Response"),
|
32 |
-
live=True
|
33 |
-
).launch()
|
34 |
-
|
35 |
-
# Web interface for voice interaction
|
36 |
-
gr.Interface(
|
37 |
-
fn=voice_ui,
|
38 |
-
inputs=gr.inputs.Audio(label="Speak your message"),
|
39 |
-
outputs=gr.outputs.Textbox(label="Transcription"),
|
40 |
-
live=True
|
41 |
-
).launch()
|
|
|
1 |
+
from flask import Flask, render_template
|
2 |
import gradio as gr
|
3 |
+
from chatbot_ai import chatbot
|
4 |
+
from voice_ai import voice_ai
|
5 |
|
|
|
6 |
app = Flask(__name__)
|
7 |
|
8 |
+
@app.route("/")
|
9 |
+
def index():
|
10 |
+
return render_template("index.html")
|
|
|
|
|
11 |
|
12 |
+
@app.route("/chatbot")
|
13 |
+
def chatbot_page():
|
14 |
+
return render_template("chatbot.html")
|
|
|
|
|
15 |
|
16 |
+
if __name__ == "__main__":
|
17 |
+
app.run(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|