-
Notifications
You must be signed in to change notification settings - Fork 1
/
starter.py
36 lines (26 loc) · 1.11 KB
/
starter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""This file starts the microservice"""
#!flask/bin/python
from flask import Flask, json, jsonify, logging, request
from Processor import Processor
with open('./config.json') as config_file:
CONFIG = json.load(config_file)
app = Flask(__name__)
###########################
# receives a json payload containing a list of app reviews
# the payload json has to contain at least a list of a single app review that contains the following fields:
# title : string
# body : string
# rating : int
# processes and classifies the raw app reviews
# classifies the processed data
###########################
@app.route("/hitec/classify/domain/google-play-reviews/", methods=["POST"])
def get_classification_result():
app.logger.debug("1. received request to classify app reviews")
app_reviews = json.loads(request.data)
processed_app_reviews = Processor.process(app_reviews)
return jsonify(processed_app_reviews)
if __name__ == "__main__":
# app.logger.setLevel(level=logging.DEBUG)
app.run(debug=False, threaded=False,
host=CONFIG['HOST'], port=CONFIG['PORT'])