Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,7 @@ device = "cpu"
|
|
| 19 |
checkpt_path = "checkpoints/disco-beta.pth.rar"
|
| 20 |
colorizer, colorLabeler = setup_model(checkpt_path, device=device)
|
| 21 |
|
|
|
|
| 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
|
|
@@ -26,10 +27,12 @@ def click_colorize(rgb_img, hint_img, n_anchors, is_high_res, is_editable):
|
|
| 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)
|
| 31 |
return output
|
| 32 |
|
|
|
|
| 33 |
## step 2: configure interface
|
| 34 |
def switch_states(is_checked):
|
| 35 |
if is_checked:
|
|
@@ -37,6 +40,7 @@ def switch_states(is_checked):
|
|
| 37 |
else:
|
| 38 |
return gr.Image.update(visible=False), gr.Button.update(visible=False)
|
| 39 |
|
|
|
|
| 40 |
demo = gr.Blocks(title="DISCO", delete_cache=(1800, 3600),)
|
| 41 |
with demo:
|
| 42 |
gr.Markdown(value="""
|
|
@@ -84,6 +88,7 @@ with demo:
|
|
| 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 |
""")
|
| 86 |
|
|
|
|
| 87 |
if RUN_MODE == "local":
|
| 88 |
demo.launch(server_name='9.134.253.83',server_port=7788)
|
| 89 |
else:
|
|
|
|
| 19 |
checkpt_path = "checkpoints/disco-beta.pth.rar"
|
| 20 |
colorizer, colorLabeler = setup_model(checkpt_path, device=device)
|
| 21 |
|
| 22 |
+
|
| 23 |
def click_colorize(rgb_img, hint_img, n_anchors, is_high_res, is_editable):
|
| 24 |
if hint_img is None:
|
| 25 |
hint_img = rgb_img
|
|
|
|
| 27 |
output1 = colorize_grayscale(colorizer, colorLabeler, rgb_img, hint_img, n_anchors, False, is_editable, device)
|
| 28 |
return output, output1
|
| 29 |
|
| 30 |
+
|
| 31 |
def click_predanchors(rgb_img, n_anchors, is_high_res, is_editable):
|
| 32 |
output = predict_anchors(colorizer, colorLabeler, rgb_img, n_anchors, is_high_res, is_editable, device)
|
| 33 |
return output
|
| 34 |
|
| 35 |
+
|
| 36 |
## step 2: configure interface
|
| 37 |
def switch_states(is_checked):
|
| 38 |
if is_checked:
|
|
|
|
| 40 |
else:
|
| 41 |
return gr.Image.update(visible=False), gr.Button.update(visible=False)
|
| 42 |
|
| 43 |
+
|
| 44 |
demo = gr.Blocks(title="DISCO", delete_cache=(1800, 3600),)
|
| 45 |
with demo:
|
| 46 |
gr.Markdown(value="""
|
|
|
|
| 88 |
<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>
|
| 89 |
""")
|
| 90 |
|
| 91 |
+
|
| 92 |
if RUN_MODE == "local":
|
| 93 |
demo.launch(server_name='9.134.253.83',server_port=7788)
|
| 94 |
else:
|