gatesla commited on
Commit
b3d0572
1 Parent(s): 578c40c

Fixed errors based on other REPO

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -148,10 +148,10 @@ def detect_objects(model_name,url_input,image_input,threshold):
148
  return viz_img, final_str
149
 
150
  def set_example_image(example: list) -> dict:
151
- return gr.Image.update(value=example[0])
152
 
153
  def set_example_url(example: list) -> dict:
154
- return gr.Textbox.update(value=example[0])
155
 
156
 
157
  title = """<h1 id="title">Object Detection App with DETR and YOLOS</h1>"""
@@ -186,7 +186,7 @@ demo = gr.Blocks(css=css)
186
 
187
  def changing():
188
  # https://discuss.huggingface.co/t/how-to-programmatically-enable-or-disable-components/52350/4
189
- return gr.Button.update(interactive=True), gr.Button.update(interactive=True)
190
 
191
 
192
 
@@ -204,7 +204,7 @@ with demo:
204
  with gr.TabItem('Image URL'):
205
  with gr.Row():
206
  url_input = gr.Textbox(lines=2,label='Enter valid image URL here..')
207
- img_output_from_url = gr.Image(shape=(650,650))
208
 
209
  with gr.Row():
210
  example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
@@ -214,7 +214,7 @@ with demo:
214
  with gr.TabItem('Image Upload'):
215
  with gr.Row():
216
  img_input = gr.Image(type='pil')
217
- img_output_from_upload= gr.Image(shape=(650,650))
218
 
219
  with gr.Row():
220
  example_images = gr.Dataset(components=[img_input],
 
148
  return viz_img, final_str
149
 
150
  def set_example_image(example: list) -> dict:
151
+ return gr.Image(value=example[0]["path"])
152
 
153
  def set_example_url(example: list) -> dict:
154
+ return gr.Textbox(value=example[0]["path"])
155
 
156
 
157
  title = """<h1 id="title">Object Detection App with DETR and YOLOS</h1>"""
 
186
 
187
  def changing():
188
  # https://discuss.huggingface.co/t/how-to-programmatically-enable-or-disable-components/52350/4
189
+ return gr.Button('Detect', interactive=True), gr.Button('Detect', interactive=True)
190
 
191
 
192
 
 
204
  with gr.TabItem('Image URL'):
205
  with gr.Row():
206
  url_input = gr.Textbox(lines=2,label='Enter valid image URL here..')
207
+ img_output_from_url = gr.Image(height=650,width=650)
208
 
209
  with gr.Row():
210
  example_url = gr.Dataset(components=[url_input],samples=[[str(url)] for url in urls])
 
214
  with gr.TabItem('Image Upload'):
215
  with gr.Row():
216
  img_input = gr.Image(type='pil')
217
+ img_output_from_upload= gr.Image(height=650,width=650)
218
 
219
  with gr.Row():
220
  example_images = gr.Dataset(components=[img_input],