prasanth345 commited on
Commit
6e45585
·
verified ·
1 Parent(s): 2f96ce5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -9
app.py CHANGED
@@ -1,14 +1,41 @@
1
  import gradio as gr
 
2
 
3
- def chatbot_response(text):
4
- # Placeholder for actual AI logic
5
- return f"You said: {text}"
6
 
7
- # Create Gradio interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  gr.Interface(
9
- fn=chatbot_response,
10
- inputs="text",
11
- outputs="text",
12
- title="Hotel Booking Voice AI Chatbot",
13
- description="Ask anything related to hotel booking",
14
  ).launch()
 
1
  import gradio as gr
2
+ from flask import Flask, render_template
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()