File size: 449 Bytes
17e67db
7e9808a
17e67db
 
 
 
 
 
 
 
0b04b1a
17e67db
d0c1ae2
17e67db
33f6a5a
17e67db
7a0c39e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline

sentiment = pipeline("sentiment-analysis")
def get_sentiment(input_text):
    return sentiment (input_text)

result = get_sentiment(" the movie was very bad")

result
[{'label': 'NEGATIVE', 'score': 0.9997990727424622}]

iface = gr.Interface(fn = get_sentiment, inputs = 'text', outputs = ['text'],title = 'Sentiment Analysis', description= 'get sentiment positive/negative')


iface.launch()