shivapaka commited on
Commit
0224d08
·
verified ·
1 Parent(s): d58a359

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -16
app.py CHANGED
@@ -1,20 +1,9 @@
1
- from flask import Flask, request, render_template
2
  from transformers import pipeline
3
 
4
- app = Flask(__name__)
 
5
 
6
- # Load the sentiment-analysis pipeline
7
- sentiment_analysis = pipeline("sentiment-analysis")
8
 
9
- @app.route('/')
10
- def home():
11
- return render_template('index.html')
12
-
13
- @app.route('/analyze', methods=['POST'])
14
- def analyze():
15
- text = request.form['text']
16
- result = sentiment_analysis(text)
17
- return render_template('result.html', text=text, result=result)
18
-
19
- if __name__ == '__main__':
20
- app.run(debug=True)
 
 
1
  from transformers import pipeline
2
 
3
+ # Create a text classification pipeline
4
+ classifier = pipeline("sentiment-analysis")
5
 
6
+ # Use the pipeline to classify some text
7
+ result = classifier("I love using Hugging Face Transformers!")
8
 
9
+ print(result)