from transformers import pipeline | |
import gradio as gr | |
classifier = pipeline("text-classification", model="joortif/clasificador-climate-claim") | |
def classify_text(text): | |
result = classifier(text) | |
return {res['label']: res['score'] for res in result} | |
demo = gr.Interface( | |
fn=classify_text, | |
inputs=gr.Textbox(lines=4, label="Escribe un texto sobre el clima"), | |
outputs=gr.Label(num_top_classes=3), | |
title="Clasificador de Afirmaciones Climáticas", | |
) | |
demo.launch() |