RottenTomatoes / app.py
cesaenv's picture
Create app.py
2cca3df verified
raw
history blame contribute delete
658 Bytes
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()