Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
rahulvenkk
commited on
Commit
•
a45652e
1
Parent(s):
8aafeea
modified app.py gradio cuda
Browse files
app.py
CHANGED
@@ -91,6 +91,7 @@ import os
|
|
91 |
# print("Preloaded images:", preloaded_images)
|
92 |
@spaces.GPU
|
93 |
def get_c(x, points):
|
|
|
94 |
with torch.no_grad():
|
95 |
counterfactual = model.get_counterfactual(x, points)
|
96 |
return counterfactual
|
@@ -257,8 +258,6 @@ with gr.Blocks() as demo:
|
|
257 |
|
258 |
points = points[:, [1, 0, 3, 2]]
|
259 |
|
260 |
-
print(points)
|
261 |
-
|
262 |
img = Image.fromarray(original_image)
|
263 |
|
264 |
transform = transforms.Compose([
|
@@ -277,7 +276,7 @@ with gr.Blocks() as demo:
|
|
277 |
x = img[:, :, None].expand(-1, -1, 3, -1, -1).to(torch.float16)
|
278 |
|
279 |
# Imagenet-normalize the inputs (standardization)
|
280 |
-
|
281 |
|
282 |
counterfactual = get_c(x, points)
|
283 |
|
|
|
91 |
# print("Preloaded images:", preloaded_images)
|
92 |
@spaces.GPU
|
93 |
def get_c(x, points):
|
94 |
+
x = utils.imagenet_normalize(x).to(device)
|
95 |
with torch.no_grad():
|
96 |
counterfactual = model.get_counterfactual(x, points)
|
97 |
return counterfactual
|
|
|
258 |
|
259 |
points = points[:, [1, 0, 3, 2]]
|
260 |
|
|
|
|
|
261 |
img = Image.fromarray(original_image)
|
262 |
|
263 |
transform = transforms.Compose([
|
|
|
276 |
x = img[:, :, None].expand(-1, -1, 3, -1, -1).to(torch.float16)
|
277 |
|
278 |
# Imagenet-normalize the inputs (standardization)
|
279 |
+
|
280 |
|
281 |
counterfactual = get_c(x, points)
|
282 |
|