fayyazio commited on
Commit
c6fccb0
·
verified ·
1 Parent(s): 42cb75b

Enable ZeroGPU for SAM 3D Objects

Browse files
Files changed (2) hide show
  1. README.md +2 -0
  2. app.py +2 -0
README.md CHANGED
@@ -7,6 +7,7 @@ sdk: gradio
7
  sdk_version: 5.49.1
8
  app_file: app.py
9
  pinned: false
 
10
  license: other
11
  short_description: Object-centric 3D reconstruction with Meta SAM 3D Objects
12
  ---
@@ -28,6 +29,7 @@ Output:
28
  Operational notes:
29
 
30
  - The official setup requires a Linux NVIDIA GPU with at least 32 GB VRAM.
 
31
  - The model checkpoints are gated. The Space needs an `HF_TOKEN` secret that has access to `facebook/sam-3d-objects`.
32
  - If the Space starts on CPU or a small GPU, the app will show diagnostics instead of failing silently.
33
 
 
7
  sdk_version: 5.49.1
8
  app_file: app.py
9
  pinned: false
10
+ suggested_hardware: zero-a10g
11
  license: other
12
  short_description: Object-centric 3D reconstruction with Meta SAM 3D Objects
13
  ---
 
29
  Operational notes:
30
 
31
  - The official setup requires a Linux NVIDIA GPU with at least 32 GB VRAM.
32
+ - This Space is configured to try Hugging Face ZeroGPU first.
33
  - The model checkpoints are gated. The Space needs an `HF_TOKEN` secret that has access to `facebook/sam-3d-objects`.
34
  - If the Space starts on CPU or a small GPU, the app will show diagnostics instead of failing silently.
35
 
app.py CHANGED
@@ -8,6 +8,7 @@ from pathlib import Path
8
  import gradio as gr
9
  import numpy as np
10
  from PIL import Image
 
11
 
12
 
13
  MODEL_REPO = "facebook/sam-3d-objects"
@@ -108,6 +109,7 @@ def prepare_mask(mask_image):
108
  return mask
109
 
110
 
 
111
  def reconstruct(image, mask_image, seed):
112
  if image is None:
113
  raise gr.Error("Upload an input image.")
 
8
  import gradio as gr
9
  import numpy as np
10
  from PIL import Image
11
+ import spaces
12
 
13
 
14
  MODEL_REPO = "facebook/sam-3d-objects"
 
109
  return mask
110
 
111
 
112
+ @spaces.GPU(duration=300)
113
  def reconstruct(image, mask_image, seed):
114
  if image is None:
115
  raise gr.Error("Upload an input image.")