Spaces:
Running on Zero
Running on Zero
Add PXDepth demo
Browse files
app.py
CHANGED
|
@@ -54,6 +54,20 @@ html, body {
|
|
| 54 |
#img-display-input, #img-display-output { max-height: 72vh; }
|
| 55 |
#img-display-output img { object-fit: contain !important; }
|
| 56 |
#model-3d { min-height: 55vh; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
"""
|
| 58 |
|
| 59 |
PAGE_JS = """
|
|
@@ -62,14 +76,26 @@ PAGE_JS = """
|
|
| 62 |
document.body.style.overflowY = "auto";
|
| 63 |
const install = () => {
|
| 64 |
const viewer = document.querySelector("#model-3d");
|
| 65 |
-
if (
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
};
|
| 74 |
install();
|
| 75 |
new MutationObserver(install).observe(document.body, { childList: true, subtree: true });
|
|
@@ -392,7 +418,7 @@ See the [paper](https://arxiv.org/abs/2608.16984),
|
|
| 392 |
)
|
| 393 |
with gr.Tab("Depth"):
|
| 394 |
depth_map = gr.ImageSlider(
|
| 395 |
-
label="RGB /
|
| 396 |
image_mode="RGB",
|
| 397 |
type="numpy",
|
| 398 |
slider_position=50,
|
|
@@ -416,7 +442,13 @@ See the [paper](https://arxiv.org/abs/2608.16984),
|
|
| 416 |
else []
|
| 417 |
)
|
| 418 |
if example_files:
|
| 419 |
-
gr.Examples(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
submit.click(
|
| 422 |
on_submit,
|
|
|
|
| 54 |
#img-display-input, #img-display-output { max-height: 72vh; }
|
| 55 |
#img-display-output img { object-fit: contain !important; }
|
| 56 |
#model-3d { min-height: 55vh; }
|
| 57 |
+
#examples-strip .gallery {
|
| 58 |
+
flex-wrap: nowrap !important;
|
| 59 |
+
overflow-x: auto;
|
| 60 |
+
overflow-y: hidden;
|
| 61 |
+
padding-bottom: 0.5rem;
|
| 62 |
+
scroll-behavior: smooth;
|
| 63 |
+
scroll-snap-type: x proximity;
|
| 64 |
+
scrollbar-width: thin;
|
| 65 |
+
-webkit-overflow-scrolling: touch;
|
| 66 |
+
}
|
| 67 |
+
#examples-strip .gallery-item {
|
| 68 |
+
flex: 0 0 auto;
|
| 69 |
+
scroll-snap-align: start;
|
| 70 |
+
}
|
| 71 |
"""
|
| 72 |
|
| 73 |
PAGE_JS = """
|
|
|
|
| 76 |
document.body.style.overflowY = "auto";
|
| 77 |
const install = () => {
|
| 78 |
const viewer = document.querySelector("#model-3d");
|
| 79 |
+
if (viewer && viewer.dataset.pageWheel !== "true") {
|
| 80 |
+
viewer.dataset.pageWheel = "true";
|
| 81 |
+
viewer.addEventListener("wheel", (event) => {
|
| 82 |
+
if (event.ctrlKey || event.metaKey) return;
|
| 83 |
+
event.preventDefault();
|
| 84 |
+
event.stopImmediatePropagation();
|
| 85 |
+
window.scrollBy({ top: event.deltaY, left: 0, behavior: "auto" });
|
| 86 |
+
}, { passive: false, capture: true });
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
const examples = document.querySelector("#examples-strip .gallery");
|
| 90 |
+
if (examples && examples.dataset.horizontalWheel !== "true") {
|
| 91 |
+
examples.dataset.horizontalWheel = "true";
|
| 92 |
+
examples.addEventListener("wheel", (event) => {
|
| 93 |
+
if (event.ctrlKey || event.metaKey) return;
|
| 94 |
+
if (Math.abs(event.deltaY) <= Math.abs(event.deltaX)) return;
|
| 95 |
+
event.preventDefault();
|
| 96 |
+
examples.scrollLeft += event.deltaY;
|
| 97 |
+
}, { passive: false });
|
| 98 |
+
}
|
| 99 |
};
|
| 100 |
install();
|
| 101 |
new MutationObserver(install).observe(document.body, { childList: true, subtree: true });
|
|
|
|
| 418 |
)
|
| 419 |
with gr.Tab("Depth"):
|
| 420 |
depth_map = gr.ImageSlider(
|
| 421 |
+
label="RGB / Depth",
|
| 422 |
image_mode="RGB",
|
| 423 |
type="numpy",
|
| 424 |
slider_position=50,
|
|
|
|
| 442 |
else []
|
| 443 |
)
|
| 444 |
if example_files:
|
| 445 |
+
gr.Examples(
|
| 446 |
+
example_files,
|
| 447 |
+
input_image,
|
| 448 |
+
cache_examples=False,
|
| 449 |
+
examples_per_page=len(example_files),
|
| 450 |
+
elem_id="examples-strip",
|
| 451 |
+
)
|
| 452 |
|
| 453 |
submit.click(
|
| 454 |
on_submit,
|