Spaces:
Running
on
Zero
Running
on
Zero
2025-07-31 19:48 π
Browse filesFixed a bug in app.py
app.py
CHANGED
@@ -236,12 +236,13 @@ def _sliding_window_predict(
|
|
236 |
# Inference function
|
237 |
# -----------------------------
|
238 |
@spaces.GPU(duration=120)
|
239 |
-
def predict(image: Image.Image,
|
240 |
"""
|
241 |
Given an input image, preprocess it, run the model to obtain a density map,
|
242 |
compute the total crowd count, and prepare the density map for display.
|
243 |
"""
|
244 |
global loaded_model
|
|
|
245 |
|
246 |
if loaded_model is None:
|
247 |
|
@@ -411,10 +412,9 @@ with gr.Blocks() as demo:
|
|
411 |
|
412 |
output_text = gr.Textbox(label="Total Count")
|
413 |
|
414 |
-
variant, dataset = model_dropdown.value.split(" @ ")
|
415 |
submit_btn.click(
|
416 |
fn=predict,
|
417 |
-
inputs=[input_img,
|
418 |
outputs=[input_img, output_structural_zero_map, output_sampling_zero_map, output_complete_zero_map, output_lambda_map, output_den_map, output_text]
|
419 |
)
|
420 |
|
|
|
236 |
# Inference function
|
237 |
# -----------------------------
|
238 |
@spaces.GPU(duration=120)
|
239 |
+
def predict(image: Image.Image, variant_dataset: str, metric: str):
|
240 |
"""
|
241 |
Given an input image, preprocess it, run the model to obtain a density map,
|
242 |
compute the total crowd count, and prepare the density map for display.
|
243 |
"""
|
244 |
global loaded_model
|
245 |
+
variant, dataset = variant_dataset.value.split(" @ ")
|
246 |
|
247 |
if loaded_model is None:
|
248 |
|
|
|
412 |
|
413 |
output_text = gr.Textbox(label="Total Count")
|
414 |
|
|
|
415 |
submit_btn.click(
|
416 |
fn=predict,
|
417 |
+
inputs=[input_img, model_dropdown, metric_dropdown],
|
418 |
outputs=[input_img, output_structural_zero_map, output_sampling_zero_map, output_complete_zero_map, output_lambda_map, output_den_map, output_text]
|
419 |
)
|
420 |
|