atatakun commited on
Commit
62f5abe
1 Parent(s): ba1e50f

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -85,17 +85,17 @@ def zoe(img, res):
85
  return [result]
86
 
87
 
88
- #model_normalbae = None
89
 
90
 
91
- #def normalbae(img, res):
92
- # img = resize_image(HWC3(img), res)
93
- # global model_normalbae
94
- # if model_normalbae is None:
95
- # from annotator.normalbae import NormalBaeDetector
96
- # model_normalbae = NormalBaeDetector()
97
- # result = model_normalbae(img)
98
- # return [result]
99
 
100
 
101
  model_openpose = None
@@ -284,16 +284,16 @@ with block:
284
  gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
285
  run_button.click(fn=zoe, inputs=[input_image, resolution], outputs=[gallery])
286
 
287
- # with gr.Row():
288
- # gr.Markdown("## Normal Bae")
289
- # with gr.Row():
290
- # with gr.Column():
291
- # input_image = gr.Image(source='upload', type="numpy")
292
- # resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
293
- # run_button = gr.Button(label="Run")
294
- # with gr.Column():
295
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
296
- # run_button.click(fn=normalbae, inputs=[input_image, resolution], outputs=[gallery])
297
 
298
  with gr.Row():
299
  gr.Markdown("## Openpose")
 
85
  return [result]
86
 
87
 
88
+ model_normalbae = None
89
 
90
 
91
+ def normalbae(img, res):
92
+ img = resize_image(HWC3(img), res)
93
+ global model_normalbae
94
+ if model_normalbae is None:
95
+ from annotator.normalbae import NormalBaeDetector
96
+ model_normalbae = NormalBaeDetector()
97
+ result = model_normalbae(img)
98
+ return [result]
99
 
100
 
101
  model_openpose = None
 
284
  gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
285
  run_button.click(fn=zoe, inputs=[input_image, resolution], outputs=[gallery])
286
 
287
+ with gr.Row():
288
+ gr.Markdown("## Normal Bae")
289
+ with gr.Row():
290
+ with gr.Column():
291
+ input_image = gr.Image(source='upload', type="numpy")
292
+ resolution = gr.Slider(label="resolution", minimum=256, maximum=1024, value=512, step=64)
293
+ run_button = gr.Button(label="Run")
294
+ with gr.Column():
295
+ gallery = gr.Gallery(label="Generated images", show_label=False).style(height="auto")
296
+ run_button.click(fn=normalbae, inputs=[input_image, resolution], outputs=[gallery])
297
 
298
  with gr.Row():
299
  gr.Markdown("## Openpose")