Spaces:
Runtime error
Runtime error
File size: 549 Bytes
60e9fe1 998b574 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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)
|