doevent commited on
Commit
3e0636f
·
verified ·
1 Parent(s): e3b54dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -6,13 +6,13 @@ from inference import setup_model, colorize_grayscale, predict_anchors
6
  ## local | remote
7
  RUN_MODE = "remote"
8
  if RUN_MODE != "local":
9
- os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/disco-beta.pth.rar")
10
  os.rename("disco-beta.pth.rar", "./checkpoints/disco-beta.pth.rar")
11
  ## examples
12
- os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/01.jpg")
13
- os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/02.jpg")
14
- os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/03.jpg")
15
- os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/04.jpg")
16
 
17
  ## step 1: set up model
18
  device = "cpu"
@@ -46,7 +46,7 @@ with demo:
46
  with gr.Column():
47
  with gr.Row():
48
  Image_input = gr.Image(type="numpy", label="Input", interactive=True)
49
- Image_anchor = gr.Image(type="numpy", label="Anchor", tool="color-sketch", interactive=True, visible=False)
50
  with gr.Row():
51
  Num_anchor = gr.Number(type="int", value=8, label="Num. of anchors (3~14)")
52
  Radio_resolution = gr.Radio(type="index", choices=["Low (256x256)", "High (512x512)"], \
@@ -56,7 +56,7 @@ with demo:
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")]
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)
 
6
  ## local | remote
7
  RUN_MODE = "remote"
8
  if RUN_MODE != "local":
9
+ os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/disco-beta.pth.rar -q -P")
10
  os.rename("disco-beta.pth.rar", "./checkpoints/disco-beta.pth.rar")
11
  ## examples
12
+ os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/01.jpg -q -P")
13
+ os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/02.jpg -q -P")
14
+ os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/03.jpg -q -P")
15
+ os.system("wget https://huggingface.co/menghanxia/disco/resolve/main/04.jpg -q -P")
16
 
17
  ## step 1: set up model
18
  device = "cpu"
 
46
  with gr.Column():
47
  with gr.Row():
48
  Image_input = gr.Image(type="numpy", label="Input", interactive=True)
49
+ Image_anchor = gr.Image(type="numpy", label="Anchor", interactive=True, visible=False)
50
  with gr.Row():
51
  Num_anchor = gr.Number(type="int", value=8, label="Num. of anchors (3~14)")
52
  Radio_resolution = gr.Radio(type="index", choices=["Low (256x256)", "High (512x512)"], \
 
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"), gr.Image(type="numpy", label="Output")]
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)