doevent commited on
Commit
a1e4d11
·
1 Parent(s): f428560

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -22,8 +22,9 @@ colorizer, colorLabeler = setup_model(checkpt_path, device=device)
22
  def click_colorize(rgb_img, hint_img, n_anchors, is_high_res, is_editable):
23
  if hint_img is None:
24
  hint_img = rgb_img
25
- output = colorize_grayscale(colorizer, colorLabeler, rgb_img, hint_img, n_anchors, is_high_res, is_editable, device)
26
- return output
 
27
 
28
  def click_predanchors(rgb_img, n_anchors, is_high_res, is_editable):
29
  output = predict_anchors(colorizer, colorLabeler, rgb_img, n_anchors, is_high_res, is_editable, device)
@@ -55,7 +56,7 @@ with demo:
55
  Button_show_anchor = gr.Button(value="Predict anchors", visible=False)
56
  Button_run = gr.Button(value="Colorize")
57
  with gr.Column():
58
- Image_output = gr.Image(type="numpy", label="Output").style(height=480)
59
 
60
  Ckeckbox_editable.change(fn=switch_states, inputs=Ckeckbox_editable, outputs=[Image_anchor, Button_show_anchor])
61
  Button_show_anchor.click(fn=click_predanchors, inputs=[Image_input, Num_anchor, Radio_resolution, Ckeckbox_editable], outputs=Image_anchor)
@@ -78,7 +79,7 @@ with demo:
78
  ['03.jpg', 8, "Low (256x256)"],
79
  ['04.jpg', 8, "Low (256x256)"],
80
  ],
81
- inputs=[Image_input,Num_anchor,Radio_resolution], outputs=[Image_output], label="Examples")
82
  gr.HTML(value="""
83
  <p style="text-align:center; color:orange"><a href='https://menghanxia.github.io/projects/disco.html' target='_blank'>DISCO Project Page</a> | <a href='https://github.com/MenghanXia/DisentangledColorization' target='_blank'>Github Repo</a></p>
84
  """)
 
22
  def click_colorize(rgb_img, hint_img, n_anchors, is_high_res, is_editable):
23
  if hint_img is None:
24
  hint_img = rgb_img
25
+ output = colorize_grayscale(colorizer, colorLabeler, rgb_img, hint_img, n_anchors, True, is_editable, device)
26
+ output1 = colorize_grayscale(colorizer, colorLabeler, rgb_img, hint_img, n_anchors, False, is_editable, device)
27
+ return output, output1
28
 
29
  def click_predanchors(rgb_img, n_anchors, is_high_res, is_editable):
30
  output = predict_anchors(colorizer, colorLabeler, rgb_img, n_anchors, is_high_res, is_editable, device)
 
56
  Button_show_anchor = gr.Button(value="Predict anchors", visible=False)
57
  Button_run = gr.Button(value="Colorize")
58
  with gr.Column():
59
+ Image_output = [gr.Image(type="numpy", label="Output").style(height=480), gr.Image(type="numpy", label="Output").style(height=480)]
60
 
61
  Ckeckbox_editable.change(fn=switch_states, inputs=Ckeckbox_editable, outputs=[Image_anchor, Button_show_anchor])
62
  Button_show_anchor.click(fn=click_predanchors, inputs=[Image_input, Num_anchor, Radio_resolution, Ckeckbox_editable], outputs=Image_anchor)
 
79
  ['03.jpg', 8, "Low (256x256)"],
80
  ['04.jpg', 8, "Low (256x256)"],
81
  ],
82
+ inputs=[Image_input,Num_anchor,Radio_resolution], outputs=[Image_output], label="Examples", cache_examples=False)
83
  gr.HTML(value="""
84
  <p style="text-align:center; color:orange"><a href='https://menghanxia.github.io/projects/disco.html' target='_blank'>DISCO Project Page</a> | <a href='https://github.com/MenghanXia/DisentangledColorization' target='_blank'>Github Repo</a></p>
85
  """)