def predict(): if request.method == 'GET': review = request.args.get('review') else: review = request.get_json(force=True)['review'] if not review: return 'No review found' return get_sentiment(review)
def predict(): if request.method == 'GET': input = request.args.get('input') else: input = request.get_json(force=True)['input'] if not input: return 'No input value found' return get_sentiment(input)
def predict(): if request.method == 'GET': input = request.args.get('input') else: input = request.get_json(force=True)['input'] if not input: return 'No input value found' response = jsonify({'text': get_sentiment(input)}) response.headers.add('Access-Control-Allow-Origin', '*') return response
def predict(): if request.method == 'GET': review = request.args.get('review') else: review = request.get_json(force=True)['review'] if not review: return 'No review found' result = get_sentiment(review) if result == 'pos': sentiment = 'Positive' else: sentiment = 'Negative' return sentiment