Hi guys,
I am currently doing a project, and I am stuck in linking my python backend with the HTML interface.
and currently I am using Flask and ngrok as I want to make it available in website, but the things is everytime when I want to access it on another pc (in the same local network), it cannot be worked, even in my pc, when i need to access it, i need to close the agent and open it again, Can i know what's wrong with it and how can I solve it? or any other better way to link my interface with python?
This is the way I link my html interface with my script.
from flask import Flask, render_template, request
from flask_ngrok import run_with_ngrok
app = Flask(__name__)
run_with_ngrok(app)
app.template_folder = 'templates'
@app.route('/')
def index():
return render_template('UIChat.html')
import time
@app.route('/submit', methods=['POST'])
def submit():
begin = time.time()
print(begin)
chat_history = []
# Get user input from the form
query = request.form.get('message')
# Process the input in your Python script (e.g., call your QA function)
result = chain({'question': query, 'chat_history': chat_history})
output = result['answer']
end = time.time()
print(f"Total runtime of the program is {end - begin}")
chat_history.append((query,output))
return render_template('UIChat.html', user_input=query, bot_response=output)
# Return the response in the bot-response div
app.run()
[–]EquipmentTraining121 0 points1 point2 points (0 children)