Skip to content

Commit

Permalink
Merge pull request #9 from Ulas-Scan/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
iyoubee authored Jun 9, 2024
2 parents 6e53a79 + 8755f3b commit 9c0f5a1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ def predict():
# statements: list of reviews
report = {'Positive': 0, 'Negative': 0}
for statement in statements:
sentiment = predict_sentiment(statement, tokenizer, model, MAX_LENGTH)
report[sentiment] += 1
try:
sentiment = predict_sentiment(statement, tokenizer, model, MAX_LENGTH)
report[sentiment] += 1
except Exception as e:
# If an error occurs, continue to the next statement
print(f"Error occurred: {e}")
continue
return jsonify(report)

if __name__ == "__main__":
Expand Down

0 comments on commit 9c0f5a1

Please sign in to comment.