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