File size: 411 Bytes
c5d9626
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from transformers import pipeline
import gradio as gr

clasificador = pipeline("sentiment-analysis")

def predecir (texto):
	resultado = clasificador (texto)[0]
	return f"Etiqueta: {resultado['label']} | Confianza: {round (resultado ['score'], 2)}"

interfaz = gr. Interface (fn=predecir, inputs="text", outputs="text", title="Análisis de Sentimientos")
interfaz.launch(server_name="0.0.0.0", server_port=7860)