File size: 1,013 Bytes
7a8db0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8113f33
 
 
c2c8674
8113f33
 
 
 
5481be8
7a8db0b
 
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
26
27
28
29
30
31
32
33
34
35
36

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)