Skip to content

Commit

Permalink
simplified for backend
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEhler2 committed Jan 30, 2024
1 parent ce560fa commit 61db9ac
Show file tree
Hide file tree
Showing 24 changed files with 29 additions and 18,555 deletions.
15 changes: 0 additions & 15 deletions .flaskenv

This file was deleted.

5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
__pycache__
.env

__pycache__/
venv/
26 changes: 26 additions & 0 deletions app.py
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)
3 changes: 1 addition & 2 deletions procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
web: gunicorn run:app

web: gunicorn app:app
23 changes: 0 additions & 23 deletions react-flask-deploy/.gitignore

This file was deleted.

70 changes: 0 additions & 70 deletions react-flask-deploy/README.md

This file was deleted.

Loading

0 comments on commit 61db9ac

Please sign in to comment.