SahilCarterr commited on
Commit
64ff386
·
verified ·
1 Parent(s): 8718841

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -35,7 +35,14 @@ text_prompt="Transform this image into a work of art by changing its style and c
35
  import os
36
  os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
37
  #pipe.to('cuda')
 
38
 
 
 
 
 
 
 
39
 
40
  def image_enhance(image, mask):
41
  image = np.array(image)
 
35
  import os
36
  os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
37
  #pipe.to('cuda')
38
+ from segment_anything import sam_model_registry, SamPredictor
39
 
40
+ sam_checkpoint = "sam_vit_h_4b8939.pth"
41
+ model_type = "vit_h"
42
+ device = "cpu"
43
+
44
+ sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
45
+ sam.to(device=device)
46
 
47
  def image_enhance(image, mask):
48
  image = np.array(image)