File size: 903 Bytes
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

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 = "Importante colocar solo una oración en español, puede contener emoji😎, para mas info @cesarriat",
                     title="Analisis de Sentimiento en Español ")
iface.launch(inline=False)