SMD00 commited on
Commit
6aa6e0d
·
1 Parent(s): d2a8976

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -299,12 +299,12 @@ def visualize(model, data, dims):
299
  L = model.L
300
  fake_imgs = lab_to_rgb(L, fake_color)
301
  real_imgs = lab_to_rgb(L, real_color)
302
- img=cv.resize(np.uint8(fake_imgs[0]), dsize=(dims[1], dims[0]), interpolation=cv2.INTER_CUBIC)
303
- return img
304
  for i in range(1):
305
  # t_img = transforms.Resize((dims[0], dims[1]))(t_img)
306
  img = Image.fromarray(np.uint8(fake_imgs[i]))
307
- img = cv.resize(fake_imgs[i], dsize=(dims[1], dims[0]), interpolation=cv.INTER_CUBIC)
308
  return img
309
  # st.text(f"Size of fake image {fake_imgs[i].shape} \n Type of image = {type(fake_imgs[i])}")
310
  # st.image(img, caption="Output image", use_column_width='auto', clamp=True)
@@ -373,8 +373,8 @@ title = "Image Colorization"
373
  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"
374
  gr.Interface(
375
  main_func,
376
- [gr.inputs.Image(type="filepath", label="Input Image") ],
377
- [gr.outputs.Textbox(label="Image Size"),gr.outputs.Image(type="numpy", label="Output Image")],
378
  title=title,
379
  description=description,
380
  # examples=[['a.png', ['Generate text']], ['b.png', ['Generate text','Summary','Important Sentences']], ]
 
299
  L = model.L
300
  fake_imgs = lab_to_rgb(L, fake_color)
301
  real_imgs = lab_to_rgb(L, real_color)
302
+ # img=cv.resize(np.uint8(fake_imgs[0]), dsize=(dims[1], dims[0]), interpolation=cv2.INTER_CUBIC)
303
+ # return img
304
  for i in range(1):
305
  # t_img = transforms.Resize((dims[0], dims[1]))(t_img)
306
  img = Image.fromarray(np.uint8(fake_imgs[i]))
307
+ img = np.uint8(cv.resize(fake_imgs[i], dsize=(dims[1], dims[0]), interpolation=cv.INTER_CUBIC))
308
  return img
309
  # st.text(f"Size of fake image {fake_imgs[i].shape} \n Type of image = {type(fake_imgs[i])}")
310
  # st.image(img, caption="Output image", use_column_width='auto', clamp=True)
 
373
  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"
374
  gr.Interface(
375
  main_func,
376
+ [grImage(type="filepath", label="Input Image") ],
377
+ [gr.Textbox(label="Image Size"),gr.Image(type="numpy", label="Output Image")],
378
  title=title,
379
  description=description,
380
  # examples=[['a.png', ['Generate text']], ['b.png', ['Generate text','Summary','Important Sentences']], ]