Skip to content

Instantly share code, notes, and snippets.

@zeroows
Created December 6, 2021 07:29
Show Gist options
  • Save zeroows/463b3ea5b5c7ebf00649bde41f9da050 to your computer and use it in GitHub Desktop.
Save zeroows/463b3ea5b5c7ebf00649bde41f9da050 to your computer and use it in GitHub Desktop.
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