xp3857 commited on
Commit
73800da
·
1 Parent(s): b786aa7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -124,7 +124,7 @@ def run_cmd(command):
124
  print("Process interrupted")
125
  sys.exit(1)
126
 
127
- def run(image,Restoration_mode, Colorizaition_mode):
128
  uid = uuid.uuid4()
129
  Restoration_mode == "BOPBTL"
130
  if os.path.isdir(f"Temp{uid}"):
@@ -133,6 +133,8 @@ def run(image,Restoration_mode, Colorizaition_mode):
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 "
@@ -151,9 +153,9 @@ def run(image,Restoration_mode, Colorizaition_mode):
151
 
152
  return result_colorization
153
  with gr.Blocks() as app:
154
- #im = gr.Image(label="Input Image")
155
- im = gr.Textbox()
156
  im_btn=gr.Button(label="Restore")
157
  out_im = gr.Image(label="Restored Image")
158
- im_btn.click(run,im,out_im)
159
  app.queue(concurrency_count=100).launch(show_api=False)
 
124
  print("Process interrupted")
125
  sys.exit(1)
126
 
127
+ def run(image,image_u=None):
128
  uid = uuid.uuid4()
129
  Restoration_mode == "BOPBTL"
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
+ if image_u != "":
137
+ image = cv2.imread(f"{image_u}")
138
  cv2.imwrite(f"Temp{uid}/input/input_img.png", image)
139
 
140
  command = ("python run.py --input_folder "
 
153
 
154
  return result_colorization
155
  with gr.Blocks() as app:
156
+ im = gr.Image(label="Input Image")
157
+ im_u = gr.Textbox()
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)