prasanth345 commited on
Commit
33df8d5
·
verified ·
1 Parent(s): 699fe54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -35
app.py CHANGED
@@ -1,41 +1,17 @@
 
1
  import gradio as gr
2
- from flask import Flask, render_templates
 
3
 
4
- # Initialize Flask app
5
  app = Flask(__name__)
6
 
7
- # Chatbot Functionality
8
- def chatbot_response(input_text):
9
- # Example response using OpenAI
10
- response = "You said: " + input_text
11
- return response
12
 
13
- # Voice AI Functionality
14
- def voice_transcription(audio):
15
- # Example voice transcription
16
- transcription = audio
17
- return transcription
18
 
19
- # Define Chatbot UI
20
- def chatbot_ui(input_text):
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)