mfernezir's picture
Update app.py
998b574
raw
history blame
549 Bytes
from transformers import pipeline, Conversation
import gradio as gr
classifier = pipeline(task="text-classification", model="SamLowe/roberta-base-go_emotions", top_k=None)
def top3_text_classes(message, history):
return str(classifier(message)[0][:3]).replace('}, {', '\n').replace('[{', '').replace('}]', '')
demo_sentiment = gr.ChatInterface(top3_text_classes, title="Text Sentiment Chatbot",
description="Enter your text, and the chatbot will classify the sentiment.")
demo_sentiment.launch(share=True)