Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -133,26 +133,26 @@ def run_cmd(command):
|
|
| 133 |
|
| 134 |
def run(image):
|
| 135 |
|
| 136 |
-
if os.path.isdir(
|
| 137 |
-
shutil.rmtree(
|
| 138 |
|
| 139 |
-
os.makedirs(
|
| 140 |
-
os.makedirs(
|
| 141 |
|
| 142 |
print(type(image))
|
| 143 |
-
cv2.imwrite(
|
| 144 |
|
| 145 |
command = ("python run.py --input_folder "
|
| 146 |
-
+
|
| 147 |
+ " --output_folder "
|
| 148 |
-
+
|
| 149 |
+ " --GPU "
|
| 150 |
+ "-1"
|
| 151 |
+ " --with_scratch")
|
| 152 |
run_cmd(command)
|
| 153 |
|
| 154 |
-
result_restoration = Image.open(
|
| 155 |
-
shutil.rmtree(
|
| 156 |
|
| 157 |
result_colorization = inferColorization(result_restoration)
|
| 158 |
|
|
|
|
| 133 |
|
| 134 |
def run(image):
|
| 135 |
|
| 136 |
+
if os.path.isdir("Temp"):
|
| 137 |
+
shutil.rmtree("Temp")
|
| 138 |
|
| 139 |
+
os.makedirs("Temp")
|
| 140 |
+
os.makedirs("Temp/input")
|
| 141 |
|
| 142 |
print(type(image))
|
| 143 |
+
cv2.imwrite("Temp/input/input_img.png", image)
|
| 144 |
|
| 145 |
command = ("python run.py --input_folder "
|
| 146 |
+
+ "Temp/input"
|
| 147 |
+ " --output_folder "
|
| 148 |
+
+ "Temp"
|
| 149 |
+ " --GPU "
|
| 150 |
+ "-1"
|
| 151 |
+ " --with_scratch")
|
| 152 |
run_cmd(command)
|
| 153 |
|
| 154 |
+
result_restoration = Image.open("Temp/final_output/input_img.png")
|
| 155 |
+
shutil.rmtree("Temp")
|
| 156 |
|
| 157 |
result_colorization = inferColorization(result_restoration)
|
| 158 |
|