Spaces:
Build error
Build error
| import gradio as gr | |
| from transformers import pipeline | |
| # Carrega do teu modelo público (para hackathon grátis serve) | |
| classifier = pipeline("text-classification", model="benfica306/GrafoPropagation-v11-Pico-Multitask") | |
| def classify(text): | |
| result = classifier(text)[0] | |
| label_map = { | |
| "LABEL_0": "🏛️ Mundo / World", | |
| "LABEL_1": "⚽ Desporto / Sports", | |
| "LABEL_2": "💼 Negócios / Business", | |
| "LABEL_3": "🔬 Ciência & Tech / Sci/Tech" | |
| } | |
| label = label_map.get(result["label"], result["label"]) | |
| return f"{label} (confiança: {result['score']:.1%})" | |
| demo = gr.Interface( | |
| fn=classify, | |
| inputs=gr.Textbox(label="Notícia/Headline", placeholder="Cole aqui uma notícia..."), | |
| outputs=gr.Textbox(label="Categoria"), | |
| title="📰 GrafoPropagation-v11 (545k params - Ultra Rápido)", | |
| description="Classificador de notícias que corre em CPU a 75k tokens/seg. Zero GPU necessária." | |
| ) | |
| demo.launch() |