Spaces:
Sleeping
Sleeping
Daniel Chang commited on
Commit ·
8993557
1
Parent(s): 51c6c50
20250712
Browse filesSentiment Analsyis
app.py
CHANGED
|
@@ -1,7 +1,11 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
classifier = pipeline("sentiment-analysis")
|
|
|
|
| 5 |
|
| 6 |
+
def predict_sentiment(text):
|
| 7 |
+
result = classifier(text)
|
| 8 |
+
return result[0]['label']
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(fn=predict_sentiment, inputs="text", outputs="text", title = 'Sentiment Analysis')
|
| 11 |
+
iface.launch()
|