Spaces:
Runtime error
Runtime error
| 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) |