Spaces:
Sleeping
Sleeping
# app.py | |
from flask import Flask, render_template, request, jsonify | |
from chatbot_engine import ChatBot | |
from stt import listen_and_transcribe | |
app = Flask(__name__) | |
bot = ChatBot() | |
def index(): | |
return render_template("index.html") | |
def ask(): | |
data = request.get_json() | |
user_input = data.get("message", "") | |
reply = bot.ask(user_input) | |
return jsonify({"reply": reply}) | |
def listen(): | |
text = listen_and_transcribe() | |
return jsonify({"text": text}) | |
if __name__ == "__main__": | |
app.run(debug=True) |