manhkhanhUIT's picture
Init
e78c13e
raw
history blame
722 Bytes
import cv2
import os
import cv2
import shutil
import sys
from subprocess import call
def run_cmd(command):
try:
call(command, shell=True)
except KeyboardInterrupt:
print("Process interrupted")
sys.exit(1)
def Restoration(image):
os.makedirs("Temp")
os.makedirs("Temp/input")
print(type(image))
cv2.imwrite("Temp/input/input_img.png", image)
command = ("python run.py --input_folder "
+ "Temp/input"
+ " --output_folder "
+ "Temp"
+ " --GPU "
+ "-1"
+ " --with_scratch")
run_cmd(command)
result = cv2.imread("Temp/final_output/input_img.png")
shutil.rmtree("Temp")
return result