gatesla commited on
Commit
4048622
1 Parent(s): d0bb262

Fixed buttons

Browse files

Buttons were not boolean and passing values is different than I thought.

Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -184,10 +184,9 @@ h1#title {
184
  demo = gr.Blocks(css=css)
185
 
186
 
187
- def changing(b1, b2, inVal, outBox):
188
  if inVal:
189
- b1.interactive = "True"
190
- b2.interactive = "True"
191
  else:
192
  outBox.value = "Select Dropdown"
193
 
@@ -212,7 +211,7 @@ with demo:
212
  with gr.Row():
213
  example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
214
 
215
- url_but = gr.Button('Detect', interactive="False")
216
 
217
  with gr.TabItem('Image Upload'):
218
  with gr.Row():
@@ -224,14 +223,14 @@ with demo:
224
  samples=[[path.as_posix()]
225
  for path in sorted(pathlib.Path('images').rglob('*.JPG'))])
226
 
227
- img_but = gr.Button('Detect', interactive="False")
228
 
229
 
230
  # output_text1 = gr.outputs.Textbox(label="Confidence Values")
231
  output_text1 = gr.components.Textbox(label="Confidence Values")
232
  # https://huggingface.co/spaces/vishnun/CLIPnCROP/blob/main/app.py -- Got .outputs. from this
233
 
234
- options.change(fn=changing, inputs=[img_but, url_but, options, output_text1])
235
 
236
 
237
  url_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_url, output_text1],queue=True)
 
184
  demo = gr.Blocks(css=css)
185
 
186
 
187
+ def changing(inVal, outBox):
188
  if inVal:
189
+ return [gr.Button('Detect', interactive=True), gr.Button('Detect', interactive=True)]
 
190
  else:
191
  outBox.value = "Select Dropdown"
192
 
 
211
  with gr.Row():
212
  example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
213
 
214
+ url_but = gr.Button('Detect', interactive=False)
215
 
216
  with gr.TabItem('Image Upload'):
217
  with gr.Row():
 
223
  samples=[[path.as_posix()]
224
  for path in sorted(pathlib.Path('images').rglob('*.JPG'))])
225
 
226
+ img_but = gr.Button('Detect', interactive=False)
227
 
228
 
229
  # output_text1 = gr.outputs.Textbox(label="Confidence Values")
230
  output_text1 = gr.components.Textbox(label="Confidence Values")
231
  # https://huggingface.co/spaces/vishnun/CLIPnCROP/blob/main/app.py -- Got .outputs. from this
232
 
233
+ options.change(fn=changing, inputs=[options, output_text1], outputs=[img_but, url_but])
234
 
235
 
236
  url_but.click(detect_objects,inputs=[options,url_input,img_input,slider_input],outputs=[img_output_from_url, output_text1],queue=True)