File size: 610 Bytes
e8ad692
 
 
 
 
 
 
 
 
 
 
 
c03d1b8
e8ad692
 
 
 
3e93e01
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline

# Load the zero-shot classification pipeline
classifier = pipeline("zero-shot-classification")

# Define the Gradio interface
iface = gr.Interface(
    fn=lambda text, candidate_labels: classifier(text, candidate_labels),
    inputs=[gr.Textbox(label="Enter Text"), gr.Textbox(label="Enter Candidate Labels (comma-separated)")],
    outputs=gr.Label(),
    live=True,
    title="Zero-Shot Classification Web App",
    description="Enter a text and candidate labels (comma-separated) to classify.",
)

# Launch the Gradio interface
iface.launch(share=True)