Alessio Grancini
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -331,6 +331,18 @@ if __name__ == "__main__":
|
|
331 |
# fn=vid_segmenation,
|
332 |
)
|
333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
334 |
|
335 |
# image tab logic
|
336 |
submit_btn_img.click(process_image, inputs=img_input, outputs=[segmentation_img_output, depth_img_output, dist_img_output, pcd_img_output])
|
@@ -345,13 +357,18 @@ if __name__ == "__main__":
|
|
345 |
options_checkbox_vid.change(update_segmentation_options, options_checkbox_vid, [])
|
346 |
conf_thres_vid.change(update_confidence_threshold, conf_thres_vid, [])
|
347 |
|
348 |
-
|
349 |
-
|
350 |
-
"
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
|
|
|
|
|
|
|
|
|
|
355 |
|
356 |
|
357 |
my_app.queue(max_size=20).launch()
|
|
|
331 |
# fn=vid_segmenation,
|
332 |
)
|
333 |
|
334 |
+
# Add a new hidden tab or interface for the API endpoint
|
335 |
+
with gr.Tab("API", visible=False): # Hidden from UI but accessible via API
|
336 |
+
input_image = gr.Image()
|
337 |
+
output_json = gr.JSON()
|
338 |
+
gr.Interface(
|
339 |
+
fn=get_detection_data,
|
340 |
+
inputs=input_image,
|
341 |
+
outputs=output_json,
|
342 |
+
title="Get Detection Data",
|
343 |
+
api_name="get_detection_data" # This sets the endpoint name
|
344 |
+
)
|
345 |
+
|
346 |
|
347 |
# image tab logic
|
348 |
submit_btn_img.click(process_image, inputs=img_input, outputs=[segmentation_img_output, depth_img_output, dist_img_output, pcd_img_output])
|
|
|
357 |
options_checkbox_vid.change(update_segmentation_options, options_checkbox_vid, [])
|
358 |
conf_thres_vid.change(update_confidence_threshold, conf_thres_vid, [])
|
359 |
|
360 |
+
|
361 |
+
# Add a new hidden tab or interface for the API endpoint
|
362 |
+
with gr.Tab("API", visible=False): # Hidden from UI but accessible via API
|
363 |
+
input_image = gr.Image()
|
364 |
+
output_json = gr.JSON()
|
365 |
+
gr.Interface(
|
366 |
+
fn=get_detection_data,
|
367 |
+
inputs=input_image,
|
368 |
+
outputs=output_json,
|
369 |
+
title="Get Detection Data",
|
370 |
+
api_name="get_detection_data" # This sets the endpoint name
|
371 |
+
)
|
372 |
|
373 |
|
374 |
my_app.queue(max_size=20).launch()
|