Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -109,15 +109,18 @@ def predict(radio, dict, word_mask, prompt=""):
|
|
109 |
img.cuda()
|
110 |
print ("yes, CUDA is available here !! ")
|
111 |
|
112 |
-
model = model.to(torch.device(device))
|
113 |
-
img = img.to(torch.device(device))
|
114 |
-
prompt = labels.to(torch.device(device))
|
115 |
#------------------
|
116 |
|
117 |
word_masks = [word_mask]
|
118 |
with torch.no_grad():
|
119 |
#torch.cuda.amp.autocast(): #
|
120 |
preds = model(img.repeat(len(word_masks),1,1,1), word_masks)[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
init_image = dict['image'].convert('RGB').resize((imgRes, imgRes))
|
122 |
filename = f"{uuid.uuid4()}.png"
|
123 |
plt.imsave(filename,torch.sigmoid(preds[0][0]))
|
@@ -144,7 +147,7 @@ def predict(radio, dict, word_mask, prompt=""):
|
|
144 |
preds = model(img.repeat(len(word_masks),1,1,1), word_masks)[0]
|
145 |
|
146 |
|
147 |
-
model = model.to(torch.device(device))
|
148 |
img = img.to(torch.device(device))
|
149 |
prompt = labels.to(torch.device(device))
|
150 |
|
|
|
109 |
img.cuda()
|
110 |
print ("yes, CUDA is available here !! ")
|
111 |
|
|
|
|
|
|
|
112 |
#------------------
|
113 |
|
114 |
word_masks = [word_mask]
|
115 |
with torch.no_grad():
|
116 |
#torch.cuda.amp.autocast(): #
|
117 |
preds = model(img.repeat(len(word_masks),1,1,1), word_masks)[0]
|
118 |
+
|
119 |
+
#model = model.to(torch.device(device))
|
120 |
+
img = img.to(torch.device(device))
|
121 |
+
prompt = labels.to(torch.device(device))
|
122 |
+
#---------
|
123 |
+
|
124 |
init_image = dict['image'].convert('RGB').resize((imgRes, imgRes))
|
125 |
filename = f"{uuid.uuid4()}.png"
|
126 |
plt.imsave(filename,torch.sigmoid(preds[0][0]))
|
|
|
147 |
preds = model(img.repeat(len(word_masks),1,1,1), word_masks)[0]
|
148 |
|
149 |
|
150 |
+
#model = model.to(torch.device(device))
|
151 |
img = img.to(torch.device(device))
|
152 |
prompt = labels.to(torch.device(device))
|
153 |
|