Spaces:
Sleeping
Sleeping
Commit ·
70aa6ed
1
Parent(s): 04711ec
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,11 @@ from transformers import pipeline
|
|
| 4 |
sentiment = pipeline("sentiment-analysis")
|
| 5 |
|
| 6 |
def get_sentiment(input_text):
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
iface = gr.Interface(fn = get_sentiment,
|
| 10 |
inputs = "text",
|
|
|
|
| 4 |
sentiment = pipeline("sentiment-analysis")
|
| 5 |
|
| 6 |
def get_sentiment(input_text):
|
| 7 |
+
results=sentiment(input_text)
|
| 8 |
+
Label=results[0]['label']
|
| 9 |
+
score=np.round(results[0]['score'],2)*100
|
| 10 |
+
output="for the give text, its a "+Label+" sentiment. with a score of " +str(score)+" !!"
|
| 11 |
+
return output
|
| 12 |
|
| 13 |
iface = gr.Interface(fn = get_sentiment,
|
| 14 |
inputs = "text",
|