efraim1011
commited on
Commit
•
93857ef
1
Parent(s):
179061d
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 f"The sentiment was {sentiment(input_text)[0]['label']} and the probabilty is {round(sentiment(input_text)[0]['score'] * 100, 2)} %"
|
9 |
+
|
10 |
+
iface = gr.Interface(fn=get_sentiment,
|
11 |
+
inputs='text',
|
12 |
+
outputs=['text'],
|
13 |
+
title="Sentiment Analysis",
|
14 |
+
description="Get sentiment Negative/Positive for the given input",
|
15 |
+
live=True)
|
16 |
+
|
17 |
+
iface.launch(inline = False)
|