File size: 495 Bytes
2d37052
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from flask import Flask, render_template, request, send_from_directory
from inference import answer

app = Flask(__name__, static_folder="frontend", template_folder="frontend", static_url_path="")

@app.route("/")
def home_page():
    return send_from_directory(app.static_folder, "index.html")

@app.route("/query/<query>", methods=["GET"])
def query(query):
    answer_text = answer(query)
    return {"answer": answer_text}

if __name__ == "__main__":
    app.run(host="0.0.0.0", port = 7860)