Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -124,7 +124,7 @@ def run_cmd(command):
|
|
124 |
print("Process interrupted")
|
125 |
sys.exit(1)
|
126 |
|
127 |
-
def run(image
|
128 |
uid = uuid.uuid4()
|
129 |
|
130 |
if os.path.isdir(f"Temp{uid}"):
|
@@ -133,8 +133,6 @@ def run(image,image_u=None):
|
|
133 |
os.makedirs(f"Temp{uid}")
|
134 |
os.makedirs(f"Temp{uid}/input")
|
135 |
print(type(image))
|
136 |
-
if image_u != "":
|
137 |
-
image = cv2.imread(image_u)
|
138 |
cv2.imwrite(f"Temp{uid}/input/input_img.png", image)
|
139 |
|
140 |
command = ("python run.py --input_folder "
|
@@ -152,10 +150,18 @@ def run(image,image_u=None):
|
|
152 |
result_colorization = inferColorization(result_restoration)
|
153 |
|
154 |
return result_colorization
|
|
|
|
|
|
|
|
|
155 |
with gr.Blocks() as app:
|
156 |
im = gr.Image(label="Input Image")
|
157 |
-
|
|
|
|
|
158 |
im_btn=gr.Button(label="Restore")
|
159 |
out_im = gr.Image(label="Restored Image")
|
|
|
|
|
160 |
im_btn.click(run,[im,im_u],out_im)
|
161 |
app.queue(concurrency_count=100).launch(show_api=False)
|
|
|
124 |
print("Process interrupted")
|
125 |
sys.exit(1)
|
126 |
|
127 |
+
def run(image):
|
128 |
uid = uuid.uuid4()
|
129 |
|
130 |
if os.path.isdir(f"Temp{uid}"):
|
|
|
133 |
os.makedirs(f"Temp{uid}")
|
134 |
os.makedirs(f"Temp{uid}/input")
|
135 |
print(type(image))
|
|
|
|
|
136 |
cv2.imwrite(f"Temp{uid}/input/input_img.png", image)
|
137 |
|
138 |
command = ("python run.py --input_folder "
|
|
|
150 |
result_colorization = inferColorization(result_restoration)
|
151 |
|
152 |
return result_colorization
|
153 |
+
def load_im(url):
|
154 |
+
return url
|
155 |
+
|
156 |
+
|
157 |
with gr.Blocks() as app:
|
158 |
im = gr.Image(label="Input Image")
|
159 |
+
with gr.Row():
|
160 |
+
im_u = gr.Textbox()
|
161 |
+
lim_btn=gr.Button("Load")
|
162 |
im_btn=gr.Button(label="Restore")
|
163 |
out_im = gr.Image(label="Restored Image")
|
164 |
+
|
165 |
+
lim_btn(load_im,im_u,im)
|
166 |
im_btn.click(run,[im,im_u],out_im)
|
167 |
app.queue(concurrency_count=100).launch(show_api=False)
|