Zing / app.py
Akshat1000's picture
Update app.py
f75296e verified
raw
history blame contribute delete
677 Bytes
from flask import Flask, render_template, request, jsonify
from getans import get_response
app = Flask(__name__)
# Store chat history
chat_history = []
@app.route('/')
def index():
return render_template('index.html', chat_history=chat_history)
@app.route('/send_message', methods=['POST'])
def send_message():
user_message = request.form['message']
# Here you can process the user message and generate a response
bot_response = get_response(user_message, max_new_tokens=100).toString()
chat_history.append({'user': user_message, 'bot': bot_response})
return jsonify(chat_history=chat_history)
if __name__ == '__main__':
app.run(debug=True)