from flask import Flask, request, render_template from api import API from voice_recognition import Voice APP = Flask(__name__) api = API() voice = Voice() messages = [] # The following method shows the user the GUI and does the backend connections to the API. @APP.route('/', methods=['GET', 'POST']) def index(): global messages if request.method == 'POST': option = request.form['option'] user_message = request.form['user_message'] if option == "voice": user_message = voice.listen() messages.append(f"User: {user_message}") elif option == "chat": messages.append(f"User: {user_message}") ai_response = "AI: " + api.send_message(user_message, 3) messages.append(ai_response) return render_template('index.html', messages=messages) @APP.route('/faq') def faq(): return render_template('faq.html') @APP.route('/documentation') def contact(): return render_template('documentation.html') if __name__ == '__main__': APP.run(debug=True) # This is a comment --> test if this creates a merge conflict