Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
def sentiment_analysis(text):
|
7 |
result = classifier(text)[0]
|
@@ -9,8 +10,8 @@ def sentiment_analysis(text):
|
|
9 |
|
10 |
iface = gr.Interface(
|
11 |
fn=sentiment_analysis,
|
12 |
-
inputs=gr.
|
13 |
-
outputs=
|
14 |
title="Simple Sentiment Analysis",
|
15 |
description="Enter a sentence and see if it's Positive or Negative!"
|
16 |
)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load the sentiment-analysis pipeline with a specified model
|
5 |
+
classifier = pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english')
|
6 |
|
7 |
def sentiment_analysis(text):
|
8 |
result = classifier(text)[0]
|
|
|
10 |
|
11 |
iface = gr.Interface(
|
12 |
fn=sentiment_analysis,
|
13 |
+
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
14 |
+
outputs=gr.Textbox(),
|
15 |
title="Simple Sentiment Analysis",
|
16 |
description="Enter a sentence and see if it's Positive or Negative!"
|
17 |
)
|