Spaces:
Sleeping
Sleeping
File size: 812 Bytes
2384f37 95f7430 2384f37 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import gradio as gr
from transformers import pipeline
def sentiment_analysis(text:str)->str:
analysis_tools = pipeline("text-classification", model = "boltuix/bert-emotion",device=0)
result = analysis_tools(text)
return f"the label: {result[0]['label']} and the score: {result[0]['score']}"
demo = gr.Interface(fn = sentiment_analysis,
inputs=['text'],
outputs = ['text'],
title="Emotion Detection",
description="Based on the bert-emotion to detect the emotion in your text",
examples=[
['I hate you'],
['You are so kind'],
['我想我们可以在一起']
]
)
demo.launch() |