Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipelines
|
| 3 |
+
|
| 4 |
+
sentiment = pipeline("sentiment-analysis")
|
| 5 |
+
def get_sentiment(input_text):
|
| 6 |
+
return sentiment (input_text)
|
| 7 |
+
|
| 8 |
+
result = get_sentiment(" the movie was very bad")
|
| 9 |
+
|
| 10 |
+
result
|
| 11 |
+
|
| 12 |
+
[{'label': 'NEGATIVE', 'score': 0.9997990727424622}]
|
| 13 |
+
|
| 14 |
+
iface = gr.Interface(fn = get_sentiment, inputs = 'text', outputs = ['text'],title = 'Sentiment Analysis')
|
| 15 |
+
|
| 16 |
+
iface.launch()
|