Spaces:
Runtime error
Runtime error
Om-Alve
commited on
Commit
·
76427af
1
Parent(s):
319f6be
downscaling
Browse files
app.py
CHANGED
@@ -35,7 +35,7 @@ class StyleTransfer(nn.Module):
|
|
35 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
36 |
|
37 |
def image_merger(content, style,beta=10,device=device):
|
38 |
-
size =
|
39 |
alpha = 1
|
40 |
beta *= 1000
|
41 |
content = Image.fromarray(content)
|
@@ -74,7 +74,7 @@ def image_merger(content, style,beta=10,device=device):
|
|
74 |
total_loss.backward(retain_graph=True)
|
75 |
opt.step()
|
76 |
scheduler.step()
|
77 |
-
if total_loss <
|
78 |
break
|
79 |
print(total_loss.item())
|
80 |
img = np.array(generated.cpu().detach().squeeze(0).permute(1,2,0))
|
|
|
35 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
36 |
|
37 |
def image_merger(content, style,beta=10,device=device):
|
38 |
+
size = 400
|
39 |
alpha = 1
|
40 |
beta *= 1000
|
41 |
content = Image.fromarray(content)
|
|
|
74 |
total_loss.backward(retain_graph=True)
|
75 |
opt.step()
|
76 |
scheduler.step()
|
77 |
+
if total_loss < 500 and device!='cuda':
|
78 |
break
|
79 |
print(total_loss.item())
|
80 |
img = np.array(generated.cpu().detach().squeeze(0).permute(1,2,0))
|