Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -126,7 +126,7 @@ def run_cmd(command):
|
|
126 |
print("Process interrupted")
|
127 |
sys.exit(1)
|
128 |
|
129 |
-
def run(image
|
130 |
|
131 |
if os.path.isdir(f"Temp{uid}"):
|
132 |
shutil.rmtree(f"Temp{uid}")
|
@@ -139,13 +139,13 @@ def run(image,txt):
|
|
139 |
command = ("python run.py --input_folder "
|
140 |
+ f"Temp{uid}/input"
|
141 |
+ " --output_folder "
|
142 |
-
+ f"Temp
|
143 |
+ " --GPU "
|
144 |
+ "-1"
|
145 |
+ " --with_scratch")
|
146 |
run_cmd(command)
|
147 |
|
148 |
-
result_restoration = Image.open(f"Temp
|
149 |
shutil.rmtree(f"Temp{uid}")
|
150 |
|
151 |
result_colorization = inferColorization(result_restoration)
|
@@ -157,12 +157,7 @@ def load_im(url):
|
|
157 |
|
158 |
with gr.Blocks() as app:
|
159 |
im = gr.Image(label="Input Image")
|
160 |
-
with gr.Row():
|
161 |
-
im_u = gr.Textbox()
|
162 |
-
lim_btn=gr.Button("Load")
|
163 |
im_btn=gr.Button(label="Restore")
|
164 |
out_im = gr.Image(label="Restored Image")
|
165 |
-
|
166 |
-
#lim_btn(load_im,im_u,im)
|
167 |
-
im_btn.click(run,[im,im_u],out_im)
|
168 |
app.queue(concurrency_count=100).launch(show_api=False)
|
|
|
126 |
print("Process interrupted")
|
127 |
sys.exit(1)
|
128 |
|
129 |
+
def run(image):
|
130 |
|
131 |
if os.path.isdir(f"Temp{uid}"):
|
132 |
shutil.rmtree(f"Temp{uid}")
|
|
|
139 |
command = ("python run.py --input_folder "
|
140 |
+ f"Temp{uid}/input"
|
141 |
+ " --output_folder "
|
142 |
+
+ f"Temp"
|
143 |
+ " --GPU "
|
144 |
+ "-1"
|
145 |
+ " --with_scratch")
|
146 |
run_cmd(command)
|
147 |
|
148 |
+
result_restoration = Image.open(f"Temp/final_output/input_img.png")
|
149 |
shutil.rmtree(f"Temp{uid}")
|
150 |
|
151 |
result_colorization = inferColorization(result_restoration)
|
|
|
157 |
|
158 |
with gr.Blocks() as app:
|
159 |
im = gr.Image(label="Input Image")
|
|
|
|
|
|
|
160 |
im_btn=gr.Button(label="Restore")
|
161 |
out_im = gr.Image(label="Restored Image")
|
162 |
+
im_btn.click(run,im,out_im)
|
|
|
|
|
163 |
app.queue(concurrency_count=100).launch(show_api=False)
|