0x90e commited on
Commit
d4772c3
·
1 Parent(s): 26e9ac1
Files changed (2) hide show
  1. app.py +1 -1
  2. test.py +3 -1
app.py CHANGED
@@ -23,7 +23,7 @@ def inference(img):
23
  run_cmd("mkdir " + OUTPUT_DIR)
24
  img.save(INPUT_DIR + "1.jpg", "JPEG")
25
 
26
- os.system("python test.py "+ os.path.join(INPUT_DIR, "1.jpg") + " " + os.path.join(OUTPUT_DIR, "1_out.jpg"))
27
  return os.path.join(OUTPUT_DIR, "1_out.jpg")
28
 
29
  input_image = gr.inputs.Image(type="pil", label="Input")
 
23
  run_cmd("mkdir " + OUTPUT_DIR)
24
  img.save(INPUT_DIR + "1.jpg", "JPEG")
25
 
26
+ run_cmd("python test.py "+ os.path.join(INPUT_DIR, "1.jpg") + " " + os.path.join(OUTPUT_DIR, "1_out.jpg"))
27
  return os.path.join(OUTPUT_DIR, "1_out.jpg")
28
 
29
  input_image = gr.inputs.Image(type="pil", label="Input")
test.py CHANGED
@@ -22,12 +22,14 @@ model = model.to(device)
22
  base = os.path.splitext(os.path.basename(img_path))[0]
23
 
24
  # read image
25
- print(img_path)
26
  img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
27
  img = torch.from_numpy(img[np.newaxis, :, :]).float()
28
  img_LR = img.unsqueeze(0)
29
  img_LR = img_LR.to(device)
30
 
 
31
  output = model(img_LR).squeeze(dim=0).float().cpu().clamp_(0, 1).numpy()
32
  output = np.transpose(output, (1, 2, 0))
 
33
  cv2.imwrite(output_dir, output, [int(cv2.IMWRITE_JPEG_QUALITY), 90])
 
22
  base = os.path.splitext(os.path.basename(img_path))[0]
23
 
24
  # read image
25
+ print(img_path);
26
  img = cv2.imread(img_path, cv2.IMREAD_GRAYSCALE)
27
  img = torch.from_numpy(img[np.newaxis, :, :]).float()
28
  img_LR = img.unsqueeze(0)
29
  img_LR = img_LR.to(device)
30
 
31
+ print('Start upscaling...')
32
  output = model(img_LR).squeeze(dim=0).float().cpu().clamp_(0, 1).numpy()
33
  output = np.transpose(output, (1, 2, 0))
34
+ print('Finished upscaling, saving image.')
35
  cv2.imwrite(output_dir, output, [int(cv2.IMWRITE_JPEG_QUALITY), 90])