INNER CODE UNIT · Python
get_status
NirantK/NLP_Quickbook · Part-08 Web Deployments/api.py:37
def get_status():
return jsonify({"version": "0.0.1", "status": True})
@app.route("/predict", methods=["POST"])
def make_prediction():
if request.method == "POST":
# get uploaded file if it exists
logger.debug(request.files)
f = request.files["file"]
f.save(f.filename) # save file to disk
logger.info(f"{f.filename} saved to disk")
# read file from disk
with open(f.filename, "r") as infile:
text_content = infile.read()
logger.info(f"Text Content from file read")