Rawal Khirodkar commited on
Commit
5fb0a38
·
1 Parent(s): a1b264d

Normal: right output is now an ImageSlider (input ↔ normal)

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -171,7 +171,8 @@ def predict(image: Image.Image, size: str, bg_mode: str):
171
  npy_path = tempfile.NamedTemporaryFile(delete=False, suffix=".npy").name
172
  np.save(npy_path, raw.astype(np.float32))
173
 
174
- return rgb_pil, rgb_pil, npy_path
 
175
 
176
 
177
  # -----------------------------------------------------------------------------
@@ -239,7 +240,12 @@ with gr.Blocks(title="Sapiens2 Normal", theme=gr.themes.Soft(), css=CUSTOM_CSS)
239
 
240
  with gr.Row(equal_height=True):
241
  inp = gr.Image(label="Input", type="pil", height=640)
242
- out_img = gr.Image(label="Normal", type="pil", height=640)
 
 
 
 
 
243
 
244
  with gr.Row():
245
  size = gr.Radio(
 
171
  npy_path = tempfile.NamedTemporaryFile(delete=False, suffix=".npy").name
172
  np.save(npy_path, raw.astype(np.float32))
173
 
174
+ # Slider value: (left_image, right_image) — left=input RGB, right=normal map.
175
+ return (image_pil, rgb_pil), rgb_pil, npy_path
176
 
177
 
178
  # -----------------------------------------------------------------------------
 
240
 
241
  with gr.Row(equal_height=True):
242
  inp = gr.Image(label="Input", type="pil", height=640)
243
+ out_img = gr.ImageSlider(
244
+ label="Input ↔ Normal (drag the divider)",
245
+ type="pil",
246
+ height=640,
247
+ slider_position=50,
248
+ )
249
 
250
  with gr.Row():
251
  size = gr.Radio(