Update app.py
Browse files
app.py
CHANGED
@@ -27,11 +27,12 @@ sam_checkpoint = "sam_hq_vit_h.pth"
|
|
27 |
model_type = "vit_h"
|
28 |
device = "cuda"
|
29 |
sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
|
30 |
-
sam.to(device=device)
|
31 |
-
predictor = SamPredictor(sam)
|
32 |
|
33 |
-
|
|
|
34 |
def generate_image(prompt, image):
|
|
|
|
|
35 |
predictor.set_image(image)
|
36 |
|
37 |
prompt = json.loads(prompt)
|
|
|
27 |
model_type = "vit_h"
|
28 |
device = "cuda"
|
29 |
sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
|
|
|
|
|
30 |
|
31 |
+
|
32 |
+
@spaces.GPU(duration=10)
|
33 |
def generate_image(prompt, image):
|
34 |
+
sam.to(device=device)
|
35 |
+
predictor = SamPredictor(sam)
|
36 |
predictor.set_image(image)
|
37 |
|
38 |
prompt = json.loads(prompt)
|