Commit
·
cf6ee13
1
Parent(s):
ab393e6
add check cuda for upload
Browse files- enhanced_app.py +21 -14
- outputs/rgb/rgb_20250714_125456.png +0 -3
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 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
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
|