Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,52 +0,0 @@
|
|
| 1 |
-
# Necessary imports
|
| 2 |
-
import gradio as gr
|
| 3 |
-
from classytext.classifier.predict import ZeroShotTextClassification
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
# Examples to display in the interface
|
| 7 |
-
examples = [
|
| 8 |
-
[
|
| 9 |
-
"I have a problem with my iPhone that needs to be resolved asap!",
|
| 10 |
-
"urgent, not urgent, phone, tablet, computer",
|
| 11 |
-
False,
|
| 12 |
-
],
|
| 13 |
-
[
|
| 14 |
-
"Angela Merkel is a politician in Germany and leader of the CDU",
|
| 15 |
-
"politics, economy, entertainment, environment",
|
| 16 |
-
False,
|
| 17 |
-
],
|
| 18 |
-
[
|
| 19 |
-
"Hi, I recently bought a device from your company but it is not working as advertised and I would like to get reimbursed!",
|
| 20 |
-
"refund, legal, faq",
|
| 21 |
-
True,
|
| 22 |
-
],
|
| 23 |
-
]
|
| 24 |
-
|
| 25 |
-
# Title and description and article for the interface
|
| 26 |
-
title = "Zero Shot Text Classification"
|
| 27 |
-
description = "Classify text using zero-shot classification with ModernBERT-large zeroshot model! Provide a text input and a list of candidate labels separated by commas. Read more at the links below."
|
| 28 |
-
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2412.13663' target='_blank'>Smarter, Better, Faster, Longer: A Modern Bidirectional Encoder for Fast, Memory Efficient, and Long Context Finetuning and Inference</a> | <a href='https://huggingface.co/MoritzLaurer/ModernBERT-large-zeroshot-v2.0' target='_blank'>Model Page</a></p>"
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
# Launch the interface
|
| 32 |
-
demo = gr.Interface(
|
| 33 |
-
fn=ZeroShotTextClassification,
|
| 34 |
-
inputs=[
|
| 35 |
-
gr.Textbox(label="Input", placeholder="Enter text to classify"),
|
| 36 |
-
gr.Textbox(
|
| 37 |
-
label="Candidate Labels",
|
| 38 |
-
placeholder="Enter candidate labels separated by commas",
|
| 39 |
-
),
|
| 40 |
-
gr.Checkbox(label="Multi-Label", value=False),
|
| 41 |
-
],
|
| 42 |
-
outputs=gr.Label(label="Classification"),
|
| 43 |
-
title=title,
|
| 44 |
-
description=description,
|
| 45 |
-
article=article,
|
| 46 |
-
examples=examples,
|
| 47 |
-
cache_examples=True,
|
| 48 |
-
cache_mode="lazy",
|
| 49 |
-
theme="Soft",
|
| 50 |
-
flagging_mode="never",
|
| 51 |
-
)
|
| 52 |
-
demo.launch(debug=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|