Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -87,9 +87,9 @@ model1 = Generator(3, 1, 3)
|
|
| 87 |
model1.load_state_dict(torch.load('model.pth', map_location=torch.device('cpu')))
|
| 88 |
model1.eval()
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
|
| 94 |
def predict(input_img, ver):
|
| 95 |
input_img = Image.open(input_img)
|
|
@@ -99,12 +99,12 @@ def predict(input_img, ver):
|
|
| 99 |
|
| 100 |
drawing = 0
|
| 101 |
with torch.no_grad():
|
| 102 |
-
|
| 103 |
|
| 104 |
drawing = transforms.ToPILImage()(drawing)
|
| 105 |
return drawing
|
| 106 |
|
| 107 |
-
|
| 108 |
# examples=[
|
| 109 |
# ['01.jpeg', 'Complex Lines'],
|
| 110 |
#]
|
|
|
|
| 87 |
model1.load_state_dict(torch.load('model.pth', map_location=torch.device('cpu')))
|
| 88 |
model1.eval()
|
| 89 |
|
| 90 |
+
model2 = Generator(3, 1, 3)
|
| 91 |
+
model2.load_state_dict(torch.load('model2.pth', map_location=torch.device('cpu')))
|
| 92 |
+
model2.eval()
|
| 93 |
|
| 94 |
def predict(input_img, ver):
|
| 95 |
input_img = Image.open(input_img)
|
|
|
|
| 99 |
|
| 100 |
drawing = 0
|
| 101 |
with torch.no_grad():
|
| 102 |
+
drawing = model1(input_img)[0].detach()
|
| 103 |
|
| 104 |
drawing = transforms.ToPILImage()(drawing)
|
| 105 |
return drawing
|
| 106 |
|
| 107 |
+
title="Image to Coloring Page Generator"
|
| 108 |
# examples=[
|
| 109 |
# ['01.jpeg', 'Complex Lines'],
|
| 110 |
#]
|