예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
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
예제 #4
0
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