markany-yhkwon commited on
Commit
c235e67
·
1 Parent(s): 72609b8
Files changed (1) hide show
  1. app.py +9 -13
app.py CHANGED
@@ -101,33 +101,29 @@ if __name__ == "__main__":
101
  with gr.Row():
102
  with gr.Column():
103
  input_image = gr.Image(type="pil")
104
- grounding_caption = gr.Textbox(label="Detection Prompt")
105
  run_button = gr.Button("Run")
106
  with gr.Accordion("Advanced options", open=False):
107
  box_threshold = gr.Slider(
108
- label="Box Threshold", minimum=0.0, maximum=1.0, value=0.25, step=0.001
109
  )
110
  text_threshold = gr.Slider(
111
- label="Text Threshold", minimum=0.0, maximum=1.0, value=0.25, step=0.001
112
  )
113
 
114
  with gr.Column():
115
- gallery = gr.outputs.Image(
116
- type="pil",
117
- # label="grounding results"
118
  ).style(full_width=True, full_height=True)
119
- # gallery = gr.Gallery(label="Generated images", show_label=False).style(
120
- # grid=[1], height="auto", container=True, full_width=True, full_height=True)
121
 
122
  run_button.click(fn=run_grounding, inputs=[
123
  input_image, grounding_caption, box_threshold, text_threshold], outputs=[gallery])
124
  gr.Examples(
125
- [["this_is_fine.png", "coffee cup", 0.25, 0.25]],
126
- inputs = [input_image, grounding_caption, box_threshold, text_threshold],
127
- outputs = [gallery],
128
  fn=run_grounding,
129
- cache_examples=True,
130
- label='Try this example input!'
131
  )
132
  block.launch(share=False, show_api=False, show_error=True)
133
 
 
101
  with gr.Row():
102
  with gr.Column():
103
  input_image = gr.Image(type="pil")
104
+ grounding_caption = gr.Textbox("Detection Prompt")
105
  run_button = gr.Button("Run")
106
  with gr.Accordion("Advanced options", open=False):
107
  box_threshold = gr.Slider(
108
+ minimum=0.0, maximum=1.0, value=0.25, step=0.001, label="Box Threshold"
109
  )
110
  text_threshold = gr.Slider(
111
+ minimum=0.0, maximum=1.0, value=0.25, step=0.001, label="Text Threshold"
112
  )
113
 
114
  with gr.Column():
115
+ gallery = gr.Image(
116
+ type="pil"
 
117
  ).style(full_width=True, full_height=True)
 
 
118
 
119
  run_button.click(fn=run_grounding, inputs=[
120
  input_image, grounding_caption, box_threshold, text_threshold], outputs=[gallery])
121
  gr.Examples(
122
+ examples=[["this_is_fine.png", "coffee cup", 0.25, 0.25]],
123
+ inputs=[input_image, grounding_caption, box_threshold, text_threshold],
124
+ outputs=[gallery],
125
  fn=run_grounding,
126
+ cache_examples=True
 
127
  )
128
  block.launch(share=False, show_api=False, show_error=True)
129