xp3857 commited on
Commit
4755925
·
1 Parent(s): d3119cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -133,27 +133,26 @@ def run_cmd(command):
133
 
134
  def run(image):
135
 
136
- if os.path.isdir(f"Temp{uid}"):
137
- shutil.rmtree(f"Temp{uid}")
138
 
139
- os.makedirs(f"Temp{uid}")
140
- os.makedirs(f"Temp{uid}/input")
141
- os.makedirs(f"Temp{uid}/final_output")
142
 
143
  print(type(image))
144
- cv2.imwrite(f"Temp{uid}/input/input_img.png", image)
145
 
146
  command = ("python run.py --input_folder "
147
- + f"Temp{uid}/input"
148
  + " --output_folder "
149
- + f"Temp{uid}"
150
  + " --GPU "
151
  + "-1"
152
  + " --with_scratch")
153
  run_cmd(command)
154
 
155
- result_restoration = Image.open(f"Temp{uid}/final_output/input_img.png")
156
- shutil.rmtree(f"Temp{uid}")
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