Spaces:
Runtime error
Runtime error
File size: 658 Bytes
2cca3df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import gradio as gr
from transformers import pipeline
# Cargar el modelo desde Hugging Face
classifier = pipeline("sentiment-analysis", model="cesaenv/rottenTomatoes")
# Definir la funci贸n de clasificaci贸n
def classify_text(text):
result = classifier(text)
return result[0]['label'], result[0]['score']
# Crear la interfaz de Gradio
iface = gr.Interface(
fn=classify_text,
inputs=gr.inputs.Textbox(lines=2, placeholder="Escribe un texto aqu铆..."),
outputs=["label", "number"],
title="Clasificaci贸n de Texto",
description="Clasificador de texto usando un modelo de Hugging Face."
)
# Ejecutar la aplicaci贸n
iface.launch()
|