GaboDataScientist
commited on
Commit
·
ba02089
1
Parent(s):
80ae9a9
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#Libraries
|
2 |
+
import gradio as gr
|
3 |
+
from transformers import pipeline
|
4 |
+
|
5 |
+
#The Model
|
6 |
+
sentiment= pipeline(task="text-classification", model="lxyuan/distilbert-base-multilingual-cased-sentiments-student",return_all_scores=True)
|
7 |
+
|
8 |
+
#The function
|
9 |
+
def get_sentiment(input_text):
|
10 |
+
return sentiment(input_text)
|
11 |
+
|
12 |
+
#The interface
|
13 |
+
iface=gr.Interface(fn=get_sentiment,
|
14 |
+
inputs="text",
|
15 |
+
outputs=['text'],
|
16 |
+
title='Sentiment Analysis',
|
17 |
+
description="Get Sentiment Positive/Negative for the given input")
|
18 |
+
iface.launch()
|