Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -301,7 +301,7 @@ def visualize(model, data, dims):
|
|
| 301 |
real_imgs = lab_to_rgb(L, real_color)
|
| 302 |
# img=cv.resize(fake_imgs[0], dsize=(dims[1], dims[0]), interpolation=cv.INTER_CUBIC)
|
| 303 |
img=fake_imgs[0]
|
| 304 |
-
return np.resize(img,(dims[1], dims[0]))
|
| 305 |
return fake_imgs[0]
|
| 306 |
for i in range(1):
|
| 307 |
# t_img = transforms.Resize((dims[0], dims[1]))(t_img)
|
|
@@ -369,14 +369,17 @@ def main_func(filepath):
|
|
| 369 |
model.setup_input(data)
|
| 370 |
model.optimize()
|
| 371 |
img=visualize(model, data, a)
|
| 372 |
-
|
|
|
|
|
|
|
|
|
|
| 373 |
|
| 374 |
title = "Image Colorization"
|
| 375 |
description = "Gradio demo for Image Colorization project. You can give an image as input on the left side and then click on the submit button. The program would recolorize the image"
|
| 376 |
gr.Interface(
|
| 377 |
main_func,
|
| 378 |
[gr.Image(type="filepath", label="Input Image") ],
|
| 379 |
-
[gr.Textbox(label="Image Size"),gr.Image(type="pil", label="Output Image"),gr.Image( label="Output Image2"),"image"],
|
| 380 |
title=title,
|
| 381 |
description=description,
|
| 382 |
examples=[ ['face.jpg'], ['montains.jpg'],['tree.jpg'] ]
|
|
|
|
| 301 |
real_imgs = lab_to_rgb(L, real_color)
|
| 302 |
# img=cv.resize(fake_imgs[0], dsize=(dims[1], dims[0]), interpolation=cv.INTER_CUBIC)
|
| 303 |
img=fake_imgs[0]
|
| 304 |
+
# return np.resize(img,(dims[1], dims[0]))
|
| 305 |
return fake_imgs[0]
|
| 306 |
for i in range(1):
|
| 307 |
# t_img = transforms.Resize((dims[0], dims[1]))(t_img)
|
|
|
|
| 369 |
model.setup_input(data)
|
| 370 |
model.optimize()
|
| 371 |
img=visualize(model, data, a)
|
| 372 |
+
img2=np.resize(img,a)
|
| 373 |
+
img3=cv.resize(img, a, interpolation=cv.INTER_CUBIC)
|
| 374 |
+
img4=cv.resize(img, a, interpolation=cv.INTER_LINEAR)
|
| 375 |
+
return (size_text,img,img2,img3,img4)
|
| 376 |
|
| 377 |
title = "Image Colorization"
|
| 378 |
description = "Gradio demo for Image Colorization project. You can give an image as input on the left side and then click on the submit button. The program would recolorize the image"
|
| 379 |
gr.Interface(
|
| 380 |
main_func,
|
| 381 |
[gr.Image(type="filepath", label="Input Image") ],
|
| 382 |
+
[gr.Textbox(label="Image Size"),gr.Image(type="pil", label="Output Image"),gr.Image( label="Output Image2"),"image","image"],
|
| 383 |
title=title,
|
| 384 |
description=description,
|
| 385 |
examples=[ ['face.jpg'], ['montains.jpg'],['tree.jpg'] ]
|