Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
|
@@ -120,13 +120,11 @@ with gr.Blocks() as demo:
|
|
| 120 |
load_output = gr.Textbox(label="Model Status", interactive=False)
|
| 121 |
|
| 122 |
gr.Examples(
|
| 123 |
-
examples=[
|
| 124 |
-
os.path.join("examples", f)
|
| 125 |
-
for f in os.listdir("examples")
|
| 126 |
-
],
|
| 127 |
inputs=image_input,
|
| 128 |
label="Example Images",
|
| 129 |
-
examples_per_page=
|
|
|
|
| 130 |
)
|
| 131 |
|
| 132 |
with gr.Column(scale=1):
|
|
@@ -137,6 +135,16 @@ with gr.Blocks() as demo:
|
|
| 137 |
label_output = gr.Label(label="Prediction Probabilities")
|
| 138 |
final_output = gr.Textbox(label="Final Prediction", interactive=False)
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
load_button.click(fn=load_model, inputs=model_selector, outputs=load_output)
|
| 141 |
predict_button.click(fn=predict, inputs=image_input, outputs=[label_output, final_output])
|
| 142 |
|
|
|
|
| 120 |
load_output = gr.Textbox(label="Model Status", interactive=False)
|
| 121 |
|
| 122 |
gr.Examples(
|
| 123 |
+
examples=[os.path.join("examples", f) for f in os.listdir("examples") if f.lower().endswith((".jpg", ".jpeg", ".png"))],
|
|
|
|
|
|
|
|
|
|
| 124 |
inputs=image_input,
|
| 125 |
label="Example Images",
|
| 126 |
+
examples_per_page=16,
|
| 127 |
+
elem_id="custom-example-gallery"
|
| 128 |
)
|
| 129 |
|
| 130 |
with gr.Column(scale=1):
|
|
|
|
| 135 |
label_output = gr.Label(label="Prediction Probabilities")
|
| 136 |
final_output = gr.Textbox(label="Final Prediction", interactive=False)
|
| 137 |
|
| 138 |
+
gr.HTML("""
|
| 139 |
+
<style>
|
| 140 |
+
#custom-example-gallery img {
|
| 141 |
+
width: 150px !important;
|
| 142 |
+
height: 150px !important;
|
| 143 |
+
object-fit: cover !important;
|
| 144 |
+
}
|
| 145 |
+
</style>
|
| 146 |
+
""")
|
| 147 |
+
|
| 148 |
load_button.click(fn=load_model, inputs=model_selector, outputs=load_output)
|
| 149 |
predict_button.click(fn=predict, inputs=image_input, outputs=[label_output, final_output])
|
| 150 |
|