Created
December 6, 2021 07:29
-
-
Save zeroows/463b3ea5b5c7ebf00649bde41f9da050 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask, jsonify, request | |
from waitress import serve | |
import logging | |
logger = logging.getLogger('waitress') | |
logger.setLevel(logging.INFO) | |
app = Flask(__name__) | |
@app.route('/', methods=["GET"]) | |
def home(): | |
logger.info("serving home") | |
return jsonify( | |
app_name="test", | |
) | |
@app.route('/tagger', methods=["POST"]) | |
def get_tagger(): | |
logger.info("serving tagger") | |
req_data = request.get_json() | |
if req_data is None: | |
return jsonify({"text": ""}) | |
return jsonify(predict(model, req_data['text'])) | |
if __name__ == '__main__': | |
serve(app, host='0.0.0.0', port=5000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment