Spaces:
Runtime error
Runtime error
Create backend/app.py
Browse files- backend/app.py +21 -0
backend/app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, render_template
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
app = Flask(__name__)
|
5 |
+
|
6 |
+
def chatbot_ai(input_text):
|
7 |
+
# Example AI response (modify with your own model)
|
8 |
+
response = f"AI: You said: {input_text}. How can I help you?"
|
9 |
+
return response
|
10 |
+
|
11 |
+
def voice_ai(voice_input):
|
12 |
+
# Simulating text from voice input (use Speech Recognition or other APIs for real-time)
|
13 |
+
response = f"AI (Voice): You said: {voice_input}. How can I assist you?"
|
14 |
+
return response
|
15 |
+
|
16 |
+
@app.route('/')
|
17 |
+
def index():
|
18 |
+
return render_template('chatbot.html')
|
19 |
+
|
20 |
+
if __name__ == '__main__':
|
21 |
+
app.run(debug=True)
|