Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,21 +56,27 @@ def report_feedback():
|
|
| 56 |
return "No prediction available to report."
|
| 57 |
|
| 58 |
# Define the Gradio interface
|
| 59 |
-
with gr.Blocks(css=custom_css,theme=gr.themes.Soft()) as demo:
|
| 60 |
gr.Markdown("### Vision Transformer Model")
|
| 61 |
gr.Markdown("Upload an image to classify it using the Vision Transformer model.")
|
| 62 |
|
| 63 |
image_input = gr.Image(type="pil", label="Upload Image")
|
| 64 |
-
prediction_output = gr.Textbox(label="Prediction", interactive=False)
|
| 65 |
-
confidence_output = gr.Textbox(label="Confidence", interactive=False)
|
| 66 |
-
feedback_output = gr.Textbox(label="Feedback Status", interactive=False)
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
with gr.Row():
|
| 69 |
submit_btn = gr.Button("Submit", variant="primary", elem_id="submit_btn")
|
| 70 |
feedback_btn = gr.Button("The model was wrong", variant="secondary", elem_id="feedback_btn")
|
| 71 |
|
| 72 |
-
gr.Markdown("<br>")
|
| 73 |
-
clear_btn = gr.Button("Clear", elem_id="clear_btn")
|
| 74 |
|
| 75 |
submit_btn.click(predict, inputs=image_input, outputs=[prediction_output, confidence_output])
|
| 76 |
feedback_btn.click(report_feedback, outputs=feedback_output)
|
|
@@ -81,9 +87,5 @@ with gr.Blocks(css=custom_css,theme=gr.themes.Soft()) as demo:
|
|
| 81 |
|
| 82 |
clear_btn.click(clear_all, outputs=[image_input, prediction_output, confidence_output, feedback_output])
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
# Launch the Gradio interface
|
| 88 |
if __name__ == "__main__":
|
| 89 |
demo.launch(share=True)
|
|
|
|
| 56 |
return "No prediction available to report."
|
| 57 |
|
| 58 |
# Define the Gradio interface
|
| 59 |
+
with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as demo:
|
| 60 |
gr.Markdown("### Vision Transformer Model")
|
| 61 |
gr.Markdown("Upload an image to classify it using the Vision Transformer model.")
|
| 62 |
|
| 63 |
image_input = gr.Image(type="pil", label="Upload Image")
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
+
# Create a row for prediction and confidence outputs
|
| 66 |
+
with gr.Row():
|
| 67 |
+
prediction_output = gr.Textbox(label="Prediction", interactive=False)
|
| 68 |
+
confidence_output = gr.Textbox(label="Confidence", interactive=False)
|
| 69 |
+
|
| 70 |
+
# Create a row for feedback output
|
| 71 |
+
feedback_output = gr.Textbox(label="Feedback Status", interactive=False)
|
| 72 |
+
|
| 73 |
+
# Buttons
|
| 74 |
with gr.Row():
|
| 75 |
submit_btn = gr.Button("Submit", variant="primary", elem_id="submit_btn")
|
| 76 |
feedback_btn = gr.Button("The model was wrong", variant="secondary", elem_id="feedback_btn")
|
| 77 |
|
| 78 |
+
gr.Markdown("<br>") # Adding space below buttons
|
| 79 |
+
clear_btn = gr.Button("Clear", elem_id="clear_btn", elem_classes="clear-button") # Add class to clear button
|
| 80 |
|
| 81 |
submit_btn.click(predict, inputs=image_input, outputs=[prediction_output, confidence_output])
|
| 82 |
feedback_btn.click(report_feedback, outputs=feedback_output)
|
|
|
|
| 87 |
|
| 88 |
clear_btn.click(clear_all, outputs=[image_input, prediction_output, confidence_output, feedback_output])
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
if __name__ == "__main__":
|
| 91 |
demo.launch(share=True)
|