pablovela5620 commited on
Commit
172fd3c
1 Parent(s): ec6007a

fix example by switching to Image output

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -1,6 +1,5 @@
1
  import gradio as gr
2
  from gradio_modal import Modal
3
- from gradio_imageslider import ImageSlider
4
 
5
  import numpy as np
6
 
@@ -55,7 +54,7 @@ def predict_normal(img_np: np.ndarray) -> tuple[np.ndarray, np.ndarray]:
55
  ) # (H, W, 3)
56
  pred_norm_np = ((pred_norm_np + 1.0) / 2.0 * 255.0).astype(np.uint8)
57
 
58
- return (img_np, pred_norm_np)
59
 
60
 
61
  with gr.Blocks() as demo:
@@ -68,7 +67,8 @@ with gr.Blocks() as demo:
68
  with gr.Group():
69
  with gr.Row():
70
  input_img = gr.Image(label="Input image", image_mode="RGB")
71
- output_img = ImageSlider(label="Surface Normal", type="numpy")
 
72
 
73
  btn = gr.Button("Predict")
74
  btn.click(fn=predict_normal, inputs=[input_img], outputs=[output_img])
 
1
  import gradio as gr
2
  from gradio_modal import Modal
 
3
 
4
  import numpy as np
5
 
 
54
  ) # (H, W, 3)
55
  pred_norm_np = ((pred_norm_np + 1.0) / 2.0 * 255.0).astype(np.uint8)
56
 
57
+ return pred_norm_np
58
 
59
 
60
  with gr.Blocks() as demo:
 
67
  with gr.Group():
68
  with gr.Row():
69
  input_img = gr.Image(label="Input image", image_mode="RGB")
70
+ output_img = gr.Image(label="Surface Normal")
71
+ # output_img = ImageSlider(label="Surface Normal")
72
 
73
  btn = gr.Button("Predict")
74
  btn.click(fn=predict_normal, inputs=[input_img], outputs=[output_img])