Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
wrapper function
Browse files
app.py
CHANGED
@@ -230,6 +230,14 @@ def video_detection(video, det_conf_thres, clf_conf_thres, target_fps, codec):
|
|
230 |
callback=callback, target_fps=int(target_fps), codec=codec)
|
231 |
return target_path
|
232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
# Building Gradio UI
|
234 |
|
235 |
with gr.Blocks() as demo:
|
@@ -304,7 +312,7 @@ with gr.Blocks() as demo:
|
|
304 |
process_files_button = gr.Button("Separate files")
|
305 |
process_result = gr.Text("Click on 'Separate files' once you see the JSON file", label="Separated files:")
|
306 |
process_btn.click(batch_path_detection, inputs=[inp_path, bth_conf_fs], outputs=bth_out2)
|
307 |
-
process_files_button.click(pw_utils.detection_folder_separation, inputs=[bth_out2, inp_path, out_path, bth_conf_fs], outputs=process_result)
|
308 |
with gr.Tab("Batch Image Process"):
|
309 |
with gr.Row():
|
310 |
with gr.Column():
|
|
|
230 |
callback=callback, target_fps=int(target_fps), codec=codec)
|
231 |
return target_path
|
232 |
|
233 |
+
def wrap_bool_output(fn):
|
234 |
+
def wrapped(*args, **kwargs):
|
235 |
+
result = fn(*args, **kwargs)
|
236 |
+
if isinstance(result, bool):
|
237 |
+
return {"success": result}
|
238 |
+
return result
|
239 |
+
return wrapped
|
240 |
+
|
241 |
# Building Gradio UI
|
242 |
|
243 |
with gr.Blocks() as demo:
|
|
|
312 |
process_files_button = gr.Button("Separate files")
|
313 |
process_result = gr.Text("Click on 'Separate files' once you see the JSON file", label="Separated files:")
|
314 |
process_btn.click(batch_path_detection, inputs=[inp_path, bth_conf_fs], outputs=bth_out2)
|
315 |
+
process_files_button.click(wrap_bool_output(pw_utils.detection_folder_separation, inputs=[bth_out2, inp_path, out_path, bth_conf_fs], outputs=process_result))
|
316 |
with gr.Tab("Batch Image Process"):
|
317 |
with gr.Row():
|
318 |
with gr.Column():
|