Update app.py
Browse files
app.py
CHANGED
@@ -93,9 +93,10 @@ def analyze():
|
|
93 |
sentiment_label = "Positive" if sentiment == 2 else "Neutral" if sentiment == 1 else "Negative"
|
94 |
return jsonify({'message': f'Sentiment analysis complete. The sentiment is: {sentiment_label}.'})
|
95 |
|
96 |
-
# Wrap the Flask app as an ASGI app
|
97 |
-
|
|
|
98 |
|
99 |
if __name__ == '__main__':
|
100 |
import uvicorn
|
101 |
-
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
93 |
sentiment_label = "Positive" if sentiment == 2 else "Neutral" if sentiment == 1 else "Negative"
|
94 |
return jsonify({'message': f'Sentiment analysis complete. The sentiment is: {sentiment_label}.'})
|
95 |
|
96 |
+
# Wrap the Flask app as an ASGI app so that the module-level variable 'app' is ASGI-compatible
|
97 |
+
from asgiref.wsgi import WsgiToAsgi
|
98 |
+
app = WsgiToAsgi(flask_app)
|
99 |
|
100 |
if __name__ == '__main__':
|
101 |
import uvicorn
|
102 |
+
uvicorn.run(app, host="0.0.0.0", port=int(os.environ.get("PORT", 7860)))
|