Spaces:
Runtime error
Runtime error
File size: 635 Bytes
e8ad692 6160819 e8ad692 b442b87 e8ad692 b442b87 6160819 7d1b617 6160819 e8ad692 aca2d8f e8ad692 b442b87 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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)
|