Spaces:
Sleeping
Sleeping
| """ | |
| from transformers import pipeline | |
| import gradio as gr | |
| import torch | |
| pipe = pipeline('sentiment-analysis') | |
| def get_sentiment(input_text): | |
| return pipe(input_text) | |
| app_examples = [ | |
| ['Não estou em minha melhor versão'], | |
| ['Relaxado como nunca'], | |
| ['Tentando relaxar, porém preocupado '] | |
| ] | |
| inputs = [ | |
| gr.Textbox(value=app_examples[0][0]), | |
| ] | |
| iface = gr.Interface(fn=get_sentiment, | |
| inputs=inputs, | |
| outputs=["text"], | |
| title='Sentiment Analysis', | |
| description='Obtenha o sentimento do texto digitado 😄|😠', | |
| examples= app_examples, | |
| theme="gradio/monochrome" | |
| ) | |
| iface.launch() | |
| """ | |
| from transformers import pipeline | |
| import gradio as gr | |
| import torch | |
| from pysentimiento import create_analyzer | |
| analyzer = create_analyzer(task="sentiment", lang="pt") | |
| def get_sentiment(input_text): | |
| prever = analyzer.predict([input_text]) | |
| return prever | |
| app_examples = [ | |
| ['A comunicação ineficaz entre as equipes dificultou o cumprimento dos prazos'], | |
| ['Só sei que nada sei'], | |
| ['Tentando relaxar, porém preocupado '] | |
| ] | |
| inputs = [ | |
| gr.Textbox(value=app_examples[0][0]), | |
| ] | |
| iface = gr.Interface(fn=get_sentiment, | |
| inputs=inputs, | |
| outputs=["text"], | |
| title='Sentiment Analysis', | |
| description='Obtenha o sentimento do texto digitado 😄😶😠', | |
| examples= app_examples, | |
| theme="gradio/monochrome" | |
| ) | |
| iface.launch() | |