Jhoeel commited on
Commit
af6166c
·
1 Parent(s): c8e40f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -16,6 +16,22 @@ with gr.Blocks() as demo:
16
  btn_clasificar = gr.Button(value="Clasificar")
17
  with gr.Column():
18
  output = gr.Textbox(label="Sentimiento")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
  btn_clasificar.click(clasificador, inputs=input, outputs=output)
21
  examples = gr.Examples(examples=['Estoy feliz 🤗 de mostrarles un toolkit para Análisis de Sentimientos y otras tareas de SocialNLP',
 
16
  btn_clasificar = gr.Button(value="Clasificar")
17
  with gr.Column():
18
  output = gr.Textbox(label="Sentimiento")
19
+
20
+ def clasificador(btn):
21
+ # perform sentiment analysis on input text and get the result as `sentiment`
22
+ sentiment = "POS" # replace with actual sentiment analysis result
23
+
24
+ # map sentiment to the corresponding label
25
+ if sentiment == "POS":
26
+ sentiment_label = "Positivo"
27
+ elif sentiment == "NEU":
28
+ sentiment_label = "Neutro"
29
+ elif sentiment == "NEG":
30
+ sentiment_label = "Negativo"
31
+ else:
32
+ sentiment_label = "Desconocido"
33
+
34
+ output.value = sentiment_label
35
 
36
  btn_clasificar.click(clasificador, inputs=input, outputs=output)
37
  examples = gr.Examples(examples=['Estoy feliz 🤗 de mostrarles un toolkit para Análisis de Sentimientos y otras tareas de SocialNLP',