casvsv's picture
Update app.py
5e6aed6
import gradio as gr
from datasets import load_dataset
from transformers import pipeline
from presentation import main_title, examples
model_name= 'hackathon-pln-es/electricidad-small-discriminator-finetuned-clasificacion-comentarios-suicidas'
def clasificar_comentarios(comentario):
cls= pipeline("text-classification", model=model_name)
return cls(comentario)[0]['label']
if __name__ == "__main__":
gr.Interface(
fn=clasificar_comentarios,
inputs=[
gr.inputs.Textbox(
lines=10,
label="Comentario a analizar:",
placeholder="Ingrese el comentario por favor...",
optional=False,
),
],
outputs=[
gr.outputs.HTML(
label="Resultado:"
)
],
description=main_title,
examples=examples,
theme="seafoam",
thumbnail="None",
css="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
).launch()