Spaces:
Runtime error
Runtime error
Commit
·
aca2d8f
1
Parent(s):
7d1b617
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load the zero-shot classification pipeline
|
5 |
classifier = pipeline("zero-shot-classification")
|
6 |
|
7 |
-
# Function to perform classification
|
8 |
def classify_text(text, candidate_labels):
|
9 |
result = classifier(text, candidate_labels)
|
10 |
return result['labels'][0], result['scores'][0]
|
11 |
|
12 |
-
# Define the Gradio interface
|
13 |
iface = gr.Interface(
|
14 |
fn=classify_text,
|
15 |
inputs=[
|
@@ -18,9 +15,8 @@ iface = gr.Interface(
|
|
18 |
],
|
19 |
outputs=gr.Textbox(),
|
20 |
live=True,
|
21 |
-
title="Zero-Shot Classification Web App",
|
22 |
description="Enter a text and candidate labels (comma-separated) to classify.",
|
23 |
)
|
24 |
|
25 |
-
# Launch the Gradio interface
|
26 |
iface.launch(share=True)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
|
|
4 |
classifier = pipeline("zero-shot-classification")
|
5 |
|
|
|
6 |
def classify_text(text, candidate_labels):
|
7 |
result = classifier(text, candidate_labels)
|
8 |
return result['labels'][0], result['scores'][0]
|
9 |
|
|
|
10 |
iface = gr.Interface(
|
11 |
fn=classify_text,
|
12 |
inputs=[
|
|
|
15 |
],
|
16 |
outputs=gr.Textbox(),
|
17 |
live=True,
|
18 |
+
title="🎯Zero-Shot Classification Web App🤖📊",
|
19 |
description="Enter a text and candidate labels (comma-separated) to classify.",
|
20 |
)
|
21 |
|
|
|
22 |
iface.launch(share=True)
|