demo-nlp-es / app.py
cesar's picture
Update app.py
c2c8674
raw
history blame contribute delete
No virus
1.01 kB
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
import gradio as gr
tokenizer = AutoTokenizer.from_pretrained(
"finiteautomata/beto-sentiment-analysis")
model = AutoModelForSequenceClassification.from_pretrained(
"finiteautomata/beto-sentiment-analysis")
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
from pysentimiento import create_analyzer
analyzer = create_analyzer(task="sentiment", lang="es")
def get_sentiment(input_text):
return analyzer.predict(input_text)
iface = gr.Interface(fn=get_sentiment,
inputs="text",
outputs=["text"],
description ="""
<p>
<center>
Importante colocar solo una oración en español, puede contener emoji😎, para mas demo.<a href='https://linktr.ee/cesarriat ' target='_blank'>haz clik aqui</a>
</p>
"""
,
title="Análisis de Sentimiento en Español ")
iface.launch(inline=False)