-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce560fa
commit 61db9ac
Showing
24 changed files
with
29 additions
and
18,555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
__pycache__ | ||
.env | ||
|
||
__pycache__/ | ||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from textblob import TextBlob | ||
from flask_cors import CORS | ||
# TextBlob(sentence).sentiment | ||
|
||
from flask import Flask, jsonify, request | ||
app = Flask(__name__) | ||
CORS(app) | ||
|
||
@app.route('/sentiment', methods=['POST']) | ||
def predict_sentiment(): | ||
data = request.get_json() | ||
sentence = data['sentence'] | ||
sentiment = TextBlob(sentence).sentiment | ||
score = sum(sentiment)/len(sentiment) | ||
if score > 0.5: | ||
res = "Positive" | ||
else: | ||
res = "Negative" | ||
return jsonify({"sentiment": res}) | ||
|
||
@app.route('/', methods=['GET']) | ||
def hello(): | ||
return jsonify({"response":"This is Sentiment Application"}) | ||
|
||
if __name__ == '__main__': | ||
app.run(host="0.0.0.0", threaded=True, port=5000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
web: gunicorn run:app | ||
|
||
web: gunicorn app:app |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.