From 92e25e90f31f70862af83f29c4c7241c70ad3e16 Mon Sep 17 00:00:00 2001 From: Sebastian Steiner Date: Tue, 11 Dec 2018 13:25:24 +0100 Subject: [PATCH] refined README.me, fixed issue #35 --- service-analysis/README.md | 2 +- service-analysis/sentiment_analysis.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/service-analysis/README.md b/service-analysis/README.md index fb414fa..a4d4cc4 100644 --- a/service-analysis/README.md +++ b/service-analysis/README.md @@ -31,7 +31,7 @@ JSON string may contain more value-key pairs than 'text', but 'text' is needed f ## run with docker - `docker build -t sentiment_analysis .` -- `docker run -d -p YOUR_PORT:8081 sentiment_analysis` +- `docker container run -d -p YOUR_PORT:8081 sentiment_analysis` ## run local ### requirements diff --git a/service-analysis/sentiment_analysis.py b/service-analysis/sentiment_analysis.py index 933ce9c..4e8f63e 100644 --- a/service-analysis/sentiment_analysis.py +++ b/service-analysis/sentiment_analysis.py @@ -2,7 +2,7 @@ import json import indicoio -from flask import Flask, request, jsonify +from flask import Flask, request, jsonify, Response from flask_restful import Resource, Api, output_json, abort app = Flask(__name__) @@ -34,7 +34,7 @@ class Sentiment_Analysis(Resource): return make_error(503, message=service_error_503) sentiment = value/len(text_array) data = {'sentiment': sentiment} - return output_json(json.dumps(data), 200) + return data, 200, {'Content-Type': 'application/json'} api.add_resource(Sentiment_Analysis, '/') -- 2.43.0