Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -95,19 +95,15 @@ def alpr_color_inference(image):
|
|
95 |
# ------------------ Gradio UI ------------------
|
96 |
with gr.Blocks() as demo:
|
97 |
gr.Markdown("# License Plate + Vehicle Color Detection")
|
98 |
-
|
99 |
with gr.Row():
|
100 |
with gr.Column():
|
101 |
-
image_input = gr.Image(type="pil", label="Upload an image"
|
102 |
-
|
103 |
-
submit_btn = gr.Button("Submit", variant="primary")
|
104 |
-
clear_btn = gr.Button("Cancel", variant="stop") # Red cancel button
|
105 |
-
|
106 |
with gr.Column():
|
107 |
plate_output = gr.Image(label="Combined Detection Output")
|
108 |
vehicle_output = gr.Image(label="(Optional) Cropped Vehicle")
|
109 |
cropped_output = gr.Image(label="(Optional) Cropped Vehicle Region")
|
110 |
-
result_text = gr.Markdown()
|
111 |
|
112 |
submit_btn.click(
|
113 |
alpr_color_inference,
|
@@ -115,28 +111,12 @@ with gr.Blocks() as demo:
|
|
115 |
outputs=[plate_output, vehicle_output, cropped_output, result_text]
|
116 |
)
|
117 |
|
118 |
-
# Clear button logic: reset everything
|
119 |
-
clear_btn.click(
|
120 |
-
lambda: (None, None, None, ""), # Empty results
|
121 |
-
inputs=[],
|
122 |
-
outputs=[plate_output, vehicle_output, cropped_output, result_text]
|
123 |
-
)
|
124 |
-
clear_btn.click(
|
125 |
-
lambda: None,
|
126 |
-
inputs=[],
|
127 |
-
outputs=[image_input]
|
128 |
-
)
|
129 |
-
|
130 |
gr.Examples(
|
131 |
examples=[
|
132 |
"examples/car1.jpg",
|
133 |
"examples/car2.jpg",
|
134 |
"examples/car3.jpg",
|
135 |
"examples/car4.jpg",
|
136 |
-
"examples/car5.jpg",
|
137 |
-
"examples/car6.jpg",
|
138 |
-
"examples/car7.jpg",
|
139 |
-
"examples/car8.jpg",
|
140 |
],
|
141 |
inputs=[image_input],
|
142 |
label="Example Images"
|
|
|
95 |
# ------------------ Gradio UI ------------------
|
96 |
with gr.Blocks() as demo:
|
97 |
gr.Markdown("# License Plate + Vehicle Color Detection")
|
|
|
98 |
with gr.Row():
|
99 |
with gr.Column():
|
100 |
+
image_input = gr.Image(type="pil", label="Upload an image")
|
101 |
+
submit_btn = gr.Button("Run Detection")
|
|
|
|
|
|
|
102 |
with gr.Column():
|
103 |
plate_output = gr.Image(label="Combined Detection Output")
|
104 |
vehicle_output = gr.Image(label="(Optional) Cropped Vehicle")
|
105 |
cropped_output = gr.Image(label="(Optional) Cropped Vehicle Region")
|
106 |
+
result_text = gr.Markdown(label="Results")
|
107 |
|
108 |
submit_btn.click(
|
109 |
alpr_color_inference,
|
|
|
111 |
outputs=[plate_output, vehicle_output, cropped_output, result_text]
|
112 |
)
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
gr.Examples(
|
115 |
examples=[
|
116 |
"examples/car1.jpg",
|
117 |
"examples/car2.jpg",
|
118 |
"examples/car3.jpg",
|
119 |
"examples/car4.jpg",
|
|
|
|
|
|
|
|
|
120 |
],
|
121 |
inputs=[image_input],
|
122 |
label="Example Images"
|