JasonYinnnn commited on
Commit
e362cad
·
1 Parent(s): f45c18c

try gradio==4.38.1

Browse files
Files changed (2) hide show
  1. app.py +15 -1
  2. requirements.txt +4 -3
app.py CHANGED
@@ -93,7 +93,21 @@ generated_object_map = {}
93
 
94
  # Prepare models
95
  ## Grounding SAM
96
- sam2_predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2-hiera-large", device=torch.device("cpu"))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
  ############## 3D-Fixer model
99
  model_dir = 'HorizonRobotics/3D-Fixer'
 
93
 
94
  # Prepare models
95
  ## Grounding SAM
96
+ if not os.path.exists("./checkpoints/sam2.1_hiera_large.pt"):
97
+ os.makedirs("./checkpoints/", exist_ok=True)
98
+ os.system("cd ./checkpoints/")
99
+ os.system("wget https://dl.fbaipublicfiles.com/segment_anything_2/092824/sam2.1_hiera_large.pt")
100
+ os.system("cd ..")
101
+ SAM2_CHECKPOINT = "./checkpoints/sam2.1_hiera_large.pt"
102
+ SAM2_CONFIG = "configs/sam2.1/sam2.1_hiera_l.yaml"
103
+
104
+ sam2_model = build_sam2(
105
+ config_file=SAM2_CONFIG,
106
+ ckpt_path=SAM2_CHECKPOINT,
107
+ device=torch.device("cpu"),
108
+ )
109
+ sam2_predictor = SAM2ImagePredictor(sam2_model)
110
+ # sam2_predictor = SAM2ImagePredictor.from_pretrained("facebook/sam2-hiera-large", device=torch.device("cpu"))
111
 
112
  ############## 3D-Fixer model
113
  model_dir = 'HorizonRobotics/3D-Fixer'
requirements.txt CHANGED
@@ -28,11 +28,12 @@ icecream
28
  plyfile
29
  pycocotools
30
  shapely
31
- gradio==4.44.1
32
  gradio_image_prompter
33
  spconv-cu118
34
  huggingface_hub==0.36.0
35
  git+https://github.com/EasternJournalist/utils3d.git@9a4eb15e4021b67b12c460c7057d642626897ec8
36
- gradio_client==1.3.0
37
  pydantic==2.10.6
38
- fastapi==0.112.2
 
 
 
 
28
  plyfile
29
  pycocotools
30
  shapely
 
31
  gradio_image_prompter
32
  spconv-cu118
33
  huggingface_hub==0.36.0
34
  git+https://github.com/EasternJournalist/utils3d.git@9a4eb15e4021b67b12c460c7057d642626897ec8
 
35
  pydantic==2.10.6
36
+ gradio==4.38.1
37
+ gradio_client==1.1.0
38
+ fastapi==0.111.1
39
+ httpx==0.27.0