Spaces:
Running
on
Zero
Running
on
Zero
drscotthawley
commited on
Commit
•
f5cc347
1
Parent(s):
1b4c6b5
removed a few decorators where they may not be needed
Browse files
app.py
CHANGED
@@ -38,7 +38,6 @@ from pom.square_to_rect import square_to_rect
|
|
38 |
|
39 |
CT_HOME = '.'
|
40 |
|
41 |
-
@spaces.GPU
|
42 |
def infer_mask_from_init_img(img, mask_with='grey'):
|
43 |
"note, this works whether image is normalized on 0..1 or -1..1, but not 0..255"
|
44 |
assert mask_with in ['blue','white','grey']
|
@@ -62,7 +61,6 @@ def infer_mask_from_init_img(img, mask_with='grey'):
|
|
62 |
return mask*1.0
|
63 |
|
64 |
|
65 |
-
@spaces.GPU
|
66 |
def count_notes_in_mask(img, mask):
|
67 |
"counts the number of new notes in the mask"
|
68 |
img_t = ToTensor()(img)
|
@@ -70,7 +68,6 @@ def count_notes_in_mask(img, mask):
|
|
70 |
return new_notes.item()
|
71 |
|
72 |
|
73 |
-
@spaces.GPU
|
74 |
def grab_dense_gen(init_img,
|
75 |
PREFIX,
|
76 |
num_to_gen=64,
|
|
|
38 |
|
39 |
CT_HOME = '.'
|
40 |
|
|
|
41 |
def infer_mask_from_init_img(img, mask_with='grey'):
|
42 |
"note, this works whether image is normalized on 0..1 or -1..1, but not 0..255"
|
43 |
assert mask_with in ['blue','white','grey']
|
|
|
61 |
return mask*1.0
|
62 |
|
63 |
|
|
|
64 |
def count_notes_in_mask(img, mask):
|
65 |
"counts the number of new notes in the mask"
|
66 |
img_t = ToTensor()(img)
|
|
|
68 |
return new_notes.item()
|
69 |
|
70 |
|
|
|
71 |
def grab_dense_gen(init_img,
|
72 |
PREFIX,
|
73 |
num_to_gen=64,
|
sample.py
CHANGED
@@ -513,10 +513,10 @@ def get_init_image_and_mask(args, device):
|
|
513 |
|
514 |
|
515 |
|
516 |
-
# wrapper compatible with ZeroGPU, callable from outside
|
517 |
-
#@spaces.GPU
|
518 |
def zero_wrapper(args, accelerator, device):
|
519 |
global init_image, init_mask
|
|
|
520 |
|
521 |
config = K.config.load_config(args.config if args.config else args.checkpoint)
|
522 |
model_config = config['model']
|
|
|
513 |
|
514 |
|
515 |
|
516 |
+
# wrapper compatible with ZeroGPU+Gradio, callable from outside
|
|
|
517 |
def zero_wrapper(args, accelerator, device):
|
518 |
global init_image, init_mask
|
519 |
+
print("zero_wrapper: Using device:", device, flush=True)
|
520 |
|
521 |
config = K.config.load_config(args.config if args.config else args.checkpoint)
|
522 |
model_config = config['model']
|