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