Spaces:
Runtime error
Runtime error
Improve output dir handling.
Browse files
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") + " " + OUTPUT_DIR)
|
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 |
+
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")
|
test.py
CHANGED
@@ -30,4 +30,4 @@ 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(
|
|
|
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])
|