Spaces:
Runtime error
Runtime error
import gradio as gr | |
from transformers import pipeline | |
classifier = pipeline("zero-shot-classification") | |
def classify_text(text, candidate_labels): | |
result = classifier(text, candidate_labels) | |
return result['labels'][0], result['scores'][0] | |
iface = gr.Interface( | |
fn=classify_text, | |
inputs=[ | |
gr.Textbox(label="Enter Text"), | |
gr.Textbox(label="Enter Candidate Labels (comma-separated)"), | |
], | |
outputs=gr.Textbox(), | |
live=True, | |
title="🎯Zero-Shot Classification Web App🤖📊", | |
description="Enter a text and candidate labels (comma-separated) to classify.", | |
) | |
iface.launch(share=True) | |