Spaces:
Runtime error
Runtime error
File size: 771 Bytes
e1110fe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from transformers import pipeline
classifier = pipeline("text-classification",
model="senti")
def func(text):
pred=classifier(text)[0]['label']
if pred=='LABEL_0':
return 'sadness'
elif pred=='LABEL_1':
return 'joy'
elif pred=='LABEL_2':
return 'love'
elif pred=='LABEL_3':
return 'anger'
elif pred=='LABEL_4':
return 'fear'
elif pred=='LABEL_5':
return 'surprise'
import gradio as gr
descriptions = "This is an AI sentiment analyzer which checks and gets the emotions in a particular text. Just put in a sentence and you'll get the probable emotions behind that sentence"
app = gr.Interface(fn=func, inputs="text", outputs="text", title="Sentiment Analayser", description=descriptions)
app.launch(share=True) |