StefanoBergia commited on
Commit
cf6ee13
·
1 Parent(s): ab393e6

add check cuda for upload

Browse files
enhanced_app.py CHANGED
@@ -898,18 +898,25 @@ def create_gradio_interface():
898
  with gr.Row():
899
  # Left Column: Controls and Input
900
  with gr.Column(scale=1):
901
- gr.Markdown("### Upload Image")
902
-
903
- uploaded_image = gr.Image(
904
- type="pil",
905
- label="Upload Image"
906
- )
907
- upload_btn = gr.Button("Process Image", variant="primary", size="lg")
 
 
 
 
 
 
 
908
 
909
  gr.Markdown("### Examples")
910
  gr.Markdown("Click on an image to load the example:")
911
 
912
- # Example gallery
913
  example_gallery = gr.Gallery(
914
  value=get_example_previews(),
915
  label="Example Images",
@@ -939,12 +946,12 @@ def create_gradio_interface():
939
  gr.Markdown("#### 3D Point Cloud")
940
  pointcloud_output = gr.Plot(label="Interactive 3D Point Cloud (Colored by Segmentation)")
941
 
942
- # Event handlers
943
- upload_btn.click(
944
- fn=process_uploaded_image,
945
- inputs=[uploaded_image],
946
- outputs=[segmentation_output, depth_output, pointcloud_output]
947
- )
948
 
949
  # Gallery selection loads example directly
950
  example_gallery.select(
 
898
  with gr.Row():
899
  # Left Column: Controls and Input
900
  with gr.Column(scale=1):
901
+ if DEPTH_AVAILABLE:
902
+ gr.Markdown("### Upload Image")
903
+
904
+ uploaded_image = gr.Image(
905
+ type="pil",
906
+ label="Upload Image"
907
+ )
908
+ upload_btn = gr.Button("Process Image", variant="primary", size="lg")
909
+ else:
910
+ uploaded_image = gr.Image(visible=False) # Hidden placeholder
911
+ upload_btn = gr.Button(visible=False) # Hidden placeholder
912
+
913
+ gr.Markdown("### CPU Mode")
914
+ gr.Markdown("⚠️ **Upload disabled**: DepthAnythingV2 requires CUDA. Using precomputed examples only.")
915
 
916
  gr.Markdown("### Examples")
917
  gr.Markdown("Click on an image to load the example:")
918
 
919
+ # Example gallery (always visible)
920
  example_gallery = gr.Gallery(
921
  value=get_example_previews(),
922
  label="Example Images",
 
946
  gr.Markdown("#### 3D Point Cloud")
947
  pointcloud_output = gr.Plot(label="Interactive 3D Point Cloud (Colored by Segmentation)")
948
 
949
+ if DEPTH_AVAILABLE:
950
+ upload_btn.click(
951
+ fn=process_uploaded_image,
952
+ inputs=[uploaded_image],
953
+ outputs=[segmentation_output, depth_output, pointcloud_output]
954
+ )
955
 
956
  # Gallery selection loads example directly
957
  example_gallery.select(
outputs/rgb/rgb_20250714_125456.png DELETED

Git LFS Details

  • SHA256: 512a7ba8783182a5ab6c51d08b1642c8ca57e14d049f8cd9d0a9d34a24e1393b
  • Pointer size: 132 Bytes
  • Size of remote file: 2.39 MB