Update app.py
Browse files
app.py
CHANGED
|
@@ -47,35 +47,24 @@ footer {display:none !important}
|
|
| 47 |
background: none rgb(66, 133, 244) !important;
|
| 48 |
box-shadow: rgb(0 0 0 / 23%) 0px 1px 7px 0px !important;
|
| 49 |
}
|
| 50 |
-
|
| 51 |
-
/* Two-column layout for text and labels */
|
| 52 |
-
.gr-blocks-container {
|
| 53 |
-
display: flex;
|
| 54 |
-
gap: 20px;
|
| 55 |
-
}
|
| 56 |
-
.gr-blocks-container .gr-block:first-child {
|
| 57 |
-
flex: 1;
|
| 58 |
-
}
|
| 59 |
-
.gr-blocks-container .gr-block:last-child {
|
| 60 |
-
flex: 1;
|
| 61 |
-
}
|
| 62 |
"""
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
| 79 |
|
| 80 |
# Launch the app
|
| 81 |
if __name__ == "__main__":
|
|
|
|
| 47 |
background: none rgb(66, 133, 244) !important;
|
| 48 |
box-shadow: rgb(0 0 0 / 23%) 0px 1px 7px 0px !important;
|
| 49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
"""
|
| 51 |
|
| 52 |
+
with gr.Blocks(css=css) as iface:
|
| 53 |
+
gr.Markdown("# Zero-Shot Text Classifier")
|
| 54 |
+
gr.Markdown("Select a model, enter text, and a set of labels to classify it using a zero-shot classification model.")
|
| 55 |
+
|
| 56 |
+
model_dropdown = gr.Dropdown(AVAILABLE_MODELS, label="Choose Model")
|
| 57 |
+
|
| 58 |
+
with gr.Row():
|
| 59 |
+
text_input = gr.Textbox(label="Enter Text", placeholder="Type or paste text here...")
|
| 60 |
+
label_input = gr.Textbox(label="Enter Labels (comma-separated)", placeholder="e.g., sports, politics, technology")
|
| 61 |
+
|
| 62 |
+
output_label = gr.Label(label="Classification Scores")
|
| 63 |
+
|
| 64 |
+
submit_button = gr.Button("Classify")
|
| 65 |
+
submit_button.click(fn=classify_text, inputs=[model_dropdown, text_input, label_input], outputs=output_label)
|
| 66 |
+
|
| 67 |
+
gr.Examples(examples, inputs=[text_input, label_input])
|
| 68 |
|
| 69 |
# Launch the app
|
| 70 |
if __name__ == "__main__":
|