Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
-
import transformers
|
3 |
|
4 |
-
|
5 |
-
model = transformers.pipeline("sentiment-analysis")
|
6 |
|
7 |
-
|
8 |
-
def sentiment_analysis(text):
|
9 |
-
result = model(text)[0]
|
10 |
-
label = result["label"]
|
11 |
-
score = result["score"]
|
12 |
-
return f"{label} with confidence score {score:.2f}"
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
# Launch the Gradio interface
|
20 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
+
from transformers import pipeline
|
|
|
4 |
|
5 |
+
sentiment= pipeline("sentiment-analysis")
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
+
def get_sentiment(input_text):
|
8 |
+
return sentiment(input_text)
|
9 |
+
|
10 |
+
iface= gr.Interface(fn= get_sentiment, inputs="text", outputs= ['text'], title='Sentiment- Analysis')
|
11 |
+
iface.launch(inline=False)
|
|
|
|