Spaces:
Running on Zero
Running on Zero
convert to ZeroGPU
Browse files- InfiniDepth/model/block/prompt_models/__pycache__/__init__.cpython-310.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/__init__.cpython-311.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/crossattn.cpython-310.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/diffattn.cpython-310.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/rope.cpython-310.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/rope.cpython-311.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/sam.cpython-310.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/sam.cpython-311.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/selfattn.cpython-310.pyc +0 -0
- InfiniDepth/model/block/prompt_models/__pycache__/selfattn.cpython-311.pyc +0 -0
- InfiniDepth/model/block/prompt_models/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- InfiniDepth/model/block/prompt_models/utils/__pycache__/pe_utils.cpython-310.pyc +0 -0
- InfiniDepth/model/block/prompt_models/utils/__pycache__/transformer.cpython-310.pyc +0 -0
- README.md +0 -4
- app.py +99 -15
- requirements.txt +5 -3
InfiniDepth/model/block/prompt_models/__pycache__/__init__.cpython-310.pyc
DELETED
|
Binary file (1.52 kB)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/__init__.cpython-311.pyc
DELETED
|
Binary file (2.44 kB)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/crossattn.cpython-310.pyc
DELETED
|
Binary file (5.79 kB)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/diffattn.cpython-310.pyc
DELETED
|
Binary file (142 Bytes)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/rope.cpython-310.pyc
DELETED
|
Binary file (8.33 kB)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/rope.cpython-311.pyc
DELETED
|
Binary file (13 kB)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/sam.cpython-310.pyc
DELETED
|
Binary file (3.54 kB)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/sam.cpython-311.pyc
DELETED
|
Binary file (5.48 kB)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/selfattn.cpython-310.pyc
DELETED
|
Binary file (8.56 kB)
|
|
|
InfiniDepth/model/block/prompt_models/__pycache__/selfattn.cpython-311.pyc
DELETED
|
Binary file (15.9 kB)
|
|
|
InfiniDepth/model/block/prompt_models/utils/__pycache__/__init__.cpython-310.pyc
CHANGED
|
Binary files a/InfiniDepth/model/block/prompt_models/utils/__pycache__/__init__.cpython-310.pyc and b/InfiniDepth/model/block/prompt_models/utils/__pycache__/__init__.cpython-310.pyc differ
|
|
|
InfiniDepth/model/block/prompt_models/utils/__pycache__/pe_utils.cpython-310.pyc
CHANGED
|
Binary files a/InfiniDepth/model/block/prompt_models/utils/__pycache__/pe_utils.cpython-310.pyc and b/InfiniDepth/model/block/prompt_models/utils/__pycache__/pe_utils.cpython-310.pyc differ
|
|
|
InfiniDepth/model/block/prompt_models/utils/__pycache__/transformer.cpython-310.pyc
CHANGED
|
Binary files a/InfiniDepth/model/block/prompt_models/utils/__pycache__/transformer.cpython-310.pyc and b/InfiniDepth/model/block/prompt_models/utils/__pycache__/transformer.cpython-310.pyc differ
|
|
|
README.md
CHANGED
|
@@ -7,7 +7,6 @@ sdk: gradio
|
|
| 7 |
sdk_version: 6.9.0
|
| 8 |
python_version: "3.10"
|
| 9 |
app_file: app.py
|
| 10 |
-
hardware: zero-a10g
|
| 11 |
preload_from_hub:
|
| 12 |
- ritianyu/InfiniDepth infinidepth.ckpt,infinidepth_depthsensor.ckpt,infinidepth_gs.ckpt,infinidepth_depthsensor_gs.ckpt,moge2.pt,skyseg.onnx
|
| 13 |
pinned: false
|
|
@@ -16,6 +15,3 @@ short_description: InfiniDepth Huggingface Demo
|
|
| 16 |
---
|
| 17 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 18 |
|
| 19 |
-
For Hugging Face Spaces, `preload_from_hub` now preloads the three checkpoint files from
|
| 20 |
-
`ritianyu/InfiniDepth` during build time. Set `INFINIDEPTH_CKPT_REPO=ritianyu/InfiniDepth`
|
| 21 |
-
in the Space variables so runtime loading resolves the same cached files.
|
|
|
|
| 7 |
sdk_version: 6.9.0
|
| 8 |
python_version: "3.10"
|
| 9 |
app_file: app.py
|
|
|
|
| 10 |
preload_from_hub:
|
| 11 |
- ritianyu/InfiniDepth infinidepth.ckpt,infinidepth_depthsensor.ckpt,infinidepth_gs.ckpt,infinidepth_depthsensor_gs.ckpt,moge2.pt,skyseg.onnx
|
| 12 |
pinned: false
|
|
|
|
| 15 |
---
|
| 16 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 17 |
|
|
|
|
|
|
|
|
|
app.py
CHANGED
|
@@ -47,6 +47,22 @@ import numpy as np
|
|
| 47 |
import torch
|
| 48 |
from huggingface_hub import hf_hub_download
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
from InfiniDepth.gs import GSPixelAlignPredictor, export_ply
|
| 51 |
from InfiniDepth.utils.gs_utils import (
|
| 52 |
_build_sparse_uniform_gaussians,
|
|
@@ -87,10 +103,14 @@ INPUT_SIZE = (768, 1024)
|
|
| 87 |
APP_NAME = "infinidepth-hf-demo"
|
| 88 |
GS_TASK_CHOICE = "3DGS"
|
| 89 |
TASK_CHOICES = ["Depth", GS_TASK_CHOICE]
|
| 90 |
-
|
|
|
|
|
|
|
| 91 |
OUTPUT_MODE_CHOICES = ["upsample", "original", "specific"]
|
| 92 |
GS_SAMPLE_POINT_NUM = 2000000
|
| 93 |
GS_COORD_DETERMINISTIC_SAMPLING = True
|
|
|
|
|
|
|
| 94 |
|
| 95 |
LOCAL_DEPTH_MODEL_PATHS = {
|
| 96 |
"InfiniDepth": APP_ROOT / "checkpoints/depth/infinidepth.ckpt",
|
|
@@ -180,7 +200,10 @@ CSS = """
|
|
| 180 |
|
| 181 |
def _ensure_cuda() -> None:
|
| 182 |
if not torch.cuda.is_available():
|
| 183 |
-
raise gr.Error(
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
|
| 186 |
def _resolve_repo_asset(local_path: Path, filename: str) -> str:
|
|
@@ -303,6 +326,31 @@ def _format_gs_status(
|
|
| 303 |
)
|
| 304 |
|
| 305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 306 |
def _load_example_image(example_name: str) -> tuple[np.ndarray, Optional[str], Optional[np.ndarray], str, str]:
|
| 307 |
if not example_name:
|
| 308 |
raise gr.Error("Select an example case first.")
|
|
@@ -315,13 +363,19 @@ def _load_example_image(example_name: str) -> tuple[np.ndarray, Optional[str], O
|
|
| 315 |
image_rgb = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB)
|
| 316 |
depth_path = case.depth_path
|
| 317 |
preview = None
|
| 318 |
-
detail =
|
| 319 |
-
|
|
|
|
|
|
|
|
|
|
| 320 |
|
| 321 |
if depth_path is not None:
|
| 322 |
preview, depth_msg = preview_depth_file(depth_path)
|
| 323 |
-
|
| 324 |
-
|
|
|
|
|
|
|
|
|
|
| 325 |
|
| 326 |
return image_rgb, depth_path, preview, model_type, detail
|
| 327 |
|
|
@@ -351,12 +405,34 @@ def _primary_view_for_task(task_type: str):
|
|
| 351 |
return gr.update(selected=selected_tab)
|
| 352 |
|
| 353 |
|
| 354 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 355 |
try:
|
| 356 |
-
|
| 357 |
except Exception as exc:
|
| 358 |
raise gr.Error(f"Failed to preview depth file: {exc}") from exc
|
| 359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 360 |
|
| 361 |
def _settings_visibility(task_type: str, output_resolution_mode: str):
|
| 362 |
is_depth = task_type == "Depth"
|
|
@@ -375,6 +451,7 @@ def _normalize_filtered_gaussians(filtered_result):
|
|
| 375 |
return filtered_result
|
| 376 |
|
| 377 |
|
|
|
|
| 378 |
@torch.no_grad()
|
| 379 |
def _run_depth_inference(
|
| 380 |
image: np.ndarray,
|
|
@@ -395,7 +472,7 @@ def _run_depth_inference(
|
|
| 395 |
_ensure_cuda()
|
| 396 |
if image is None:
|
| 397 |
raise gr.Error("Upload an image or load an example before running inference.")
|
| 398 |
-
if model_type ==
|
| 399 |
raise gr.Error("InfiniDepth_DepthSensor requires an input depth file.")
|
| 400 |
|
| 401 |
skyseg_path = _resolve_skyseg_path() if enable_skyseg_model else None
|
|
@@ -522,6 +599,7 @@ def _run_depth_inference(
|
|
| 522 |
)
|
| 523 |
|
| 524 |
|
|
|
|
| 525 |
@torch.no_grad()
|
| 526 |
def _run_gs_inference(
|
| 527 |
image: np.ndarray,
|
|
@@ -537,7 +615,7 @@ def _run_gs_inference(
|
|
| 537 |
_ensure_cuda()
|
| 538 |
if image is None:
|
| 539 |
raise gr.Error("Upload an image or load an example before running inference.")
|
| 540 |
-
if model_type ==
|
| 541 |
raise gr.Error("InfiniDepth_DepthSensor requires an input depth file for GS inference.")
|
| 542 |
|
| 543 |
image_rgb, image_tensor, (org_h, org_w) = _prepare_image_tensors(image)
|
|
@@ -730,7 +808,7 @@ def _clear_outputs():
|
|
| 730 |
with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
| 731 |
gr.Markdown("# InfiniDepth Demo")
|
| 732 |
gr.Markdown(
|
| 733 |
-
"Switch between depth inference and GS inference
|
| 734 |
)
|
| 735 |
|
| 736 |
selected_example_name = gr.State(DEFAULT_EXAMPLE_NAME)
|
|
@@ -738,7 +816,7 @@ with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
|
| 738 |
with gr.Row(elem_id="top-workspace"):
|
| 739 |
with gr.Column(scale=4, min_width=320, elem_id="controls-column"):
|
| 740 |
task_type = gr.Radio(label="Inference Task", choices=TASK_CHOICES, value="Depth")
|
| 741 |
-
model_type = gr.Radio(label="Model Type", choices=MODEL_CHOICES, value=
|
| 742 |
|
| 743 |
gr.Markdown("### Example Data")
|
| 744 |
example_gallery = gr.Gallery(
|
|
@@ -793,7 +871,7 @@ with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
|
| 793 |
height=240,
|
| 794 |
elem_id="input-depth-preview",
|
| 795 |
)
|
| 796 |
-
depth_info = gr.Markdown("No input depth loaded.")
|
| 797 |
submit_btn = gr.Button("Run Inference", variant="primary")
|
| 798 |
|
| 799 |
with gr.Column(scale=8, min_width=640, elem_id="outputs-column"):
|
|
@@ -859,10 +937,16 @@ with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
|
| 859 |
outputs=[selected_example_name, example_selection],
|
| 860 |
)
|
| 861 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 862 |
input_depth_file.change(
|
| 863 |
fn=_update_depth_preview,
|
| 864 |
-
inputs=[input_depth_file],
|
| 865 |
-
outputs=[input_depth_preview, depth_info],
|
| 866 |
)
|
| 867 |
|
| 868 |
load_example_btn.click(
|
|
|
|
| 47 |
import torch
|
| 48 |
from huggingface_hub import hf_hub_download
|
| 49 |
|
| 50 |
+
try:
|
| 51 |
+
import spaces
|
| 52 |
+
except ImportError:
|
| 53 |
+
class _SpacesFallback:
|
| 54 |
+
@staticmethod
|
| 55 |
+
def GPU(fn=None, **_kwargs):
|
| 56 |
+
if callable(fn):
|
| 57 |
+
return fn
|
| 58 |
+
|
| 59 |
+
def decorator(inner_fn):
|
| 60 |
+
return inner_fn
|
| 61 |
+
|
| 62 |
+
return decorator
|
| 63 |
+
|
| 64 |
+
spaces = _SpacesFallback()
|
| 65 |
+
|
| 66 |
from InfiniDepth.gs import GSPixelAlignPredictor, export_ply
|
| 67 |
from InfiniDepth.utils.gs_utils import (
|
| 68 |
_build_sparse_uniform_gaussians,
|
|
|
|
| 103 |
APP_NAME = "infinidepth-hf-demo"
|
| 104 |
GS_TASK_CHOICE = "3DGS"
|
| 105 |
TASK_CHOICES = ["Depth", GS_TASK_CHOICE]
|
| 106 |
+
RGB_MODEL_TYPE = "InfiniDepth"
|
| 107 |
+
DEPTH_SENSOR_MODEL_TYPE = "InfiniDepth_DepthSensor"
|
| 108 |
+
MODEL_CHOICES = [RGB_MODEL_TYPE, DEPTH_SENSOR_MODEL_TYPE]
|
| 109 |
OUTPUT_MODE_CHOICES = ["upsample", "original", "specific"]
|
| 110 |
GS_SAMPLE_POINT_NUM = 2000000
|
| 111 |
GS_COORD_DETERMINISTIC_SAMPLING = True
|
| 112 |
+
DEPTH_GPU_DURATION_SECONDS = 180
|
| 113 |
+
GS_GPU_DURATION_SECONDS = 240
|
| 114 |
|
| 115 |
LOCAL_DEPTH_MODEL_PATHS = {
|
| 116 |
"InfiniDepth": APP_ROOT / "checkpoints/depth/infinidepth.ckpt",
|
|
|
|
| 200 |
|
| 201 |
def _ensure_cuda() -> None:
|
| 202 |
if not torch.cuda.is_available():
|
| 203 |
+
raise gr.Error(
|
| 204 |
+
"No CUDA device is available for this request. On Hugging Face ZeroGPU, "
|
| 205 |
+
"GPU access is only attached while the decorated inference call is running."
|
| 206 |
+
)
|
| 207 |
|
| 208 |
|
| 209 |
def _resolve_repo_asset(local_path: Path, filename: str) -> str:
|
|
|
|
| 326 |
)
|
| 327 |
|
| 328 |
|
| 329 |
+
def _model_availability_note(depth_path: Optional[str], model_type: str, *, auto_switched: bool = False) -> str:
|
| 330 |
+
if depth_path:
|
| 331 |
+
if auto_switched and model_type == DEPTH_SENSOR_MODEL_TYPE:
|
| 332 |
+
return (
|
| 333 |
+
"Depth file loaded. Switched model to `InfiniDepth_DepthSensor`. "
|
| 334 |
+
"You can still switch back to `InfiniDepth` for RGB-only inference."
|
| 335 |
+
)
|
| 336 |
+
return (
|
| 337 |
+
"Depth file loaded. `InfiniDepth_DepthSensor` is available. "
|
| 338 |
+
"You can also keep `InfiniDepth` for RGB-only inference."
|
| 339 |
+
)
|
| 340 |
+
|
| 341 |
+
if auto_switched:
|
| 342 |
+
return (
|
| 343 |
+
"No input depth loaded. Switched model back to `InfiniDepth`. "
|
| 344 |
+
"Upload a depth file to enable `InfiniDepth_DepthSensor`."
|
| 345 |
+
)
|
| 346 |
+
|
| 347 |
+
return "No input depth loaded. `InfiniDepth` will be used until you upload a depth file."
|
| 348 |
+
|
| 349 |
+
|
| 350 |
+
def _compose_depth_info_message(base_message: str, note: str) -> str:
|
| 351 |
+
return f"{base_message}\n\n{note}" if note else base_message
|
| 352 |
+
|
| 353 |
+
|
| 354 |
def _load_example_image(example_name: str) -> tuple[np.ndarray, Optional[str], Optional[np.ndarray], str, str]:
|
| 355 |
if not example_name:
|
| 356 |
raise gr.Error("Select an example case first.")
|
|
|
|
| 363 |
image_rgb = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB)
|
| 364 |
depth_path = case.depth_path
|
| 365 |
preview = None
|
| 366 |
+
detail = _compose_depth_info_message(
|
| 367 |
+
f"Loaded example `{case.name}`.",
|
| 368 |
+
_model_availability_note(None, RGB_MODEL_TYPE),
|
| 369 |
+
)
|
| 370 |
+
model_type = RGB_MODEL_TYPE
|
| 371 |
|
| 372 |
if depth_path is not None:
|
| 373 |
preview, depth_msg = preview_depth_file(depth_path)
|
| 374 |
+
model_type = DEPTH_SENSOR_MODEL_TYPE
|
| 375 |
+
detail = _compose_depth_info_message(
|
| 376 |
+
f"Loaded example `{case.name}` with paired depth. {depth_msg}",
|
| 377 |
+
_model_availability_note(depth_path, model_type, auto_switched=True),
|
| 378 |
+
)
|
| 379 |
|
| 380 |
return image_rgb, depth_path, preview, model_type, detail
|
| 381 |
|
|
|
|
| 405 |
return gr.update(selected=selected_tab)
|
| 406 |
|
| 407 |
|
| 408 |
+
def _reset_uploaded_image_state(
|
| 409 |
+
_image: Optional[np.ndarray],
|
| 410 |
+
depth_path: Optional[str],
|
| 411 |
+
) -> tuple[None, None, str, str]:
|
| 412 |
+
note = (
|
| 413 |
+
"Image updated. Cleared the previous depth file. Upload a new depth file to enable "
|
| 414 |
+
"`InfiniDepth_DepthSensor`."
|
| 415 |
+
if depth_path
|
| 416 |
+
else "Image updated. Upload a depth file to enable `InfiniDepth_DepthSensor`."
|
| 417 |
+
)
|
| 418 |
+
return None, None, RGB_MODEL_TYPE, note
|
| 419 |
+
|
| 420 |
+
|
| 421 |
+
def _update_depth_preview(depth_path: Optional[str], model_type: str) -> tuple[Optional[np.ndarray], str, str]:
|
| 422 |
try:
|
| 423 |
+
preview, depth_msg = preview_depth_file(depth_path)
|
| 424 |
except Exception as exc:
|
| 425 |
raise gr.Error(f"Failed to preview depth file: {exc}") from exc
|
| 426 |
|
| 427 |
+
if depth_path:
|
| 428 |
+
next_model = DEPTH_SENSOR_MODEL_TYPE
|
| 429 |
+
note = _model_availability_note(depth_path, next_model, auto_switched=(model_type != next_model))
|
| 430 |
+
else:
|
| 431 |
+
next_model = RGB_MODEL_TYPE
|
| 432 |
+
note = _model_availability_note(depth_path, next_model, auto_switched=(model_type != next_model))
|
| 433 |
+
|
| 434 |
+
return preview, next_model, _compose_depth_info_message(depth_msg, note)
|
| 435 |
+
|
| 436 |
|
| 437 |
def _settings_visibility(task_type: str, output_resolution_mode: str):
|
| 438 |
is_depth = task_type == "Depth"
|
|
|
|
| 451 |
return filtered_result
|
| 452 |
|
| 453 |
|
| 454 |
+
@spaces.GPU(duration=DEPTH_GPU_DURATION_SECONDS)
|
| 455 |
@torch.no_grad()
|
| 456 |
def _run_depth_inference(
|
| 457 |
image: np.ndarray,
|
|
|
|
| 472 |
_ensure_cuda()
|
| 473 |
if image is None:
|
| 474 |
raise gr.Error("Upload an image or load an example before running inference.")
|
| 475 |
+
if model_type == DEPTH_SENSOR_MODEL_TYPE and not depth_file:
|
| 476 |
raise gr.Error("InfiniDepth_DepthSensor requires an input depth file.")
|
| 477 |
|
| 478 |
skyseg_path = _resolve_skyseg_path() if enable_skyseg_model else None
|
|
|
|
| 599 |
)
|
| 600 |
|
| 601 |
|
| 602 |
+
@spaces.GPU(duration=GS_GPU_DURATION_SECONDS)
|
| 603 |
@torch.no_grad()
|
| 604 |
def _run_gs_inference(
|
| 605 |
image: np.ndarray,
|
|
|
|
| 615 |
_ensure_cuda()
|
| 616 |
if image is None:
|
| 617 |
raise gr.Error("Upload an image or load an example before running inference.")
|
| 618 |
+
if model_type == DEPTH_SENSOR_MODEL_TYPE and not depth_file:
|
| 619 |
raise gr.Error("InfiniDepth_DepthSensor requires an input depth file for GS inference.")
|
| 620 |
|
| 621 |
image_rgb, image_tensor, (org_h, org_w) = _prepare_image_tensors(image)
|
|
|
|
| 808 |
with gr.Blocks(css=CSS, theme=gr.themes.Soft()) as demo:
|
| 809 |
gr.Markdown("# InfiniDepth Demo")
|
| 810 |
gr.Markdown(
|
| 811 |
+
"Switch between depth inference and GS inference. `InfiniDepth` works with RGB-only inputs, while `InfiniDepth_DepthSensor` is enabled only after you upload a depth file or load an example with paired depth."
|
| 812 |
)
|
| 813 |
|
| 814 |
selected_example_name = gr.State(DEFAULT_EXAMPLE_NAME)
|
|
|
|
| 816 |
with gr.Row(elem_id="top-workspace"):
|
| 817 |
with gr.Column(scale=4, min_width=320, elem_id="controls-column"):
|
| 818 |
task_type = gr.Radio(label="Inference Task", choices=TASK_CHOICES, value="Depth")
|
| 819 |
+
model_type = gr.Radio(label="Model Type", choices=MODEL_CHOICES, value=RGB_MODEL_TYPE)
|
| 820 |
|
| 821 |
gr.Markdown("### Example Data")
|
| 822 |
example_gallery = gr.Gallery(
|
|
|
|
| 871 |
height=240,
|
| 872 |
elem_id="input-depth-preview",
|
| 873 |
)
|
| 874 |
+
depth_info = gr.Markdown("No input depth loaded. `InfiniDepth` will be used until you upload a depth file.")
|
| 875 |
submit_btn = gr.Button("Run Inference", variant="primary")
|
| 876 |
|
| 877 |
with gr.Column(scale=8, min_width=640, elem_id="outputs-column"):
|
|
|
|
| 937 |
outputs=[selected_example_name, example_selection],
|
| 938 |
)
|
| 939 |
|
| 940 |
+
input_image.input(
|
| 941 |
+
fn=_reset_uploaded_image_state,
|
| 942 |
+
inputs=[input_image, input_depth_file],
|
| 943 |
+
outputs=[input_depth_file, input_depth_preview, model_type, depth_info],
|
| 944 |
+
)
|
| 945 |
+
|
| 946 |
input_depth_file.change(
|
| 947 |
fn=_update_depth_preview,
|
| 948 |
+
inputs=[input_depth_file, model_type],
|
| 949 |
+
outputs=[input_depth_preview, model_type, depth_info],
|
| 950 |
)
|
| 951 |
|
| 952 |
load_example_btn.click(
|
requirements.txt
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
-
# Runtime dependencies for the Hugging Face Space demo.
|
| 2 |
-
#
|
| 3 |
-
#
|
|
|
|
|
|
|
| 4 |
|
| 5 |
torch==2.9.1
|
| 6 |
torchvision==0.24.1
|
|
|
|
| 1 |
+
# Runtime dependencies for the Hugging Face ZeroGPU Space demo.
|
| 2 |
+
# Keep Python on 3.10 in README.md so the pinned torch build and open3d wheels
|
| 3 |
+
# remain compatible with the deployment environment.
|
| 4 |
+
|
| 5 |
+
spaces
|
| 6 |
|
| 7 |
torch==2.9.1
|
| 8 |
torchvision==0.24.1
|