This is api.py file

parent 263821d6
from flask import Flask, render_template, Response, request
from flask_cors import CORS
from chatbot.chat import get_res
from web_app import web_camera
employee_id = ''
app = Flask(__name__)
CORS(app)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/chat', methods=['GET', 'POST'])
def chat():
global employee_id
employee_id = request.form['employee_id']
return render_template('chat.html')
@app.route('/video_feed')
def video_feed():
return Response(web_camera(), mimetype='multipart/x-mixed-replace; boundary=frame')
@app.route('/admin')
def admin():
return render_template('admin.html')
@app.route('/chat_bot', methods=['GET', 'POST'])
def chat_bot():
msg = request.form['msg']
bot_reply = get_res(msg)
return str(bot_reply)
if __name__ == "__main__":
app.run(debug=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment