mgbam commited on
Commit
a8e3a46
·
verified ·
1 Parent(s): 8525122

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -25
app.py DELETED
@@ -1,25 +0,0 @@
1
- from flask import Flask, jsonify, request
2
- import requests
3
- from transformers import pipeline
4
-
5
- app = Flask(__name__)
6
-
7
- # Initialize sentiment analysis pipeline from Hugging Face
8
- sentiment_analysis = pipeline("sentiment-analysis")
9
-
10
- # Example endpoint for sentiment analysis using Hugging Face Transformers
11
- @app.route('/api/sentiment', methods=['POST'])
12
- def analyze_sentiment():
13
- try:
14
- text = request.json['text']
15
-
16
- # Perform sentiment analysis
17
- result = sentiment_analysis(text)
18
-
19
- return jsonify(result), 200
20
-
21
- except Exception as e:
22
- return jsonify({'error': str(e)}), 500
23
-
24
- if __name__ == '__main__':
25
- app.run(host='0.0.0.0', port=5000)