JasonYinnnn commited on
Commit
6939f2c
·
1 Parent(s): 2a36119

global model

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -143,6 +143,7 @@ def run_segmentation(
143
  rgb_image = image_prompts["image"].convert("RGB")
144
 
145
  global work_space
 
146
 
147
  device = "cpu"
148
  sam_segmentator.to(device=device, dtype=DTYPE if device == 'cuda' else torch.float32)
@@ -188,6 +189,7 @@ def run_depth_estimation(
188
  )
189
 
190
  rgb_image = rgb_image.resize((1024, 1024), Image.Resampling.LANCZOS)
 
191
 
192
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
193
  dtype = torch.float16 if device == 'cuda' else torch.float32
@@ -852,9 +854,8 @@ with gr.Blocks() as demo:
852
 
853
  if __name__ == '__main__':
854
 
855
- work_space = None
856
- dpt_pack = None
857
- generated_object_map = {}
858
 
859
  # Prepare models
860
  ## Grounding SAM
 
143
  rgb_image = image_prompts["image"].convert("RGB")
144
 
145
  global work_space
146
+ global sam_segmentator
147
 
148
  device = "cpu"
149
  sam_segmentator.to(device=device, dtype=DTYPE if device == 'cuda' else torch.float32)
 
189
  )
190
 
191
  rgb_image = rgb_image.resize((1024, 1024), Image.Resampling.LANCZOS)
192
+ global moge_v2_dpt_model
193
 
194
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
195
  dtype = torch.float16 if device == 'cuda' else torch.float32
 
854
 
855
  if __name__ == '__main__':
856
 
857
+ global sam_segmentator
858
+ global moge_v2_dpt_model
 
859
 
860
  # Prepare models
861
  ## Grounding SAM