Ethgoin commited on
Commit
c5d9626
·
verified ·
1 Parent(s): 2e02d75

First commit app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ clasificador = pipeline("sentiment-analysis")
5
+
6
+ def predecir (texto):
7
+ resultado = clasificador (texto)[0]
8
+ return f"Etiqueta: {resultado['label']} | Confianza: {round (resultado ['score'], 2)}"
9
+
10
+ interfaz = gr. Interface (fn=predecir, inputs="text", outputs="text", title="Análisis de Sentimientos")
11
+ interfaz.launch(server_name="0.0.0.0", server_port=7860)