h-siyuan commited on
Commit
6976657
·
verified ·
1 Parent(s): a47493c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -222,10 +222,10 @@ def build_demo(embed_mode, concurrency_count=1):
222
  ["./examples/safari_google.png", "Click on search bar.", True],
223
  ]
224
 
225
- def check_if_example(image_path, query):
226
- """Check if the image and query match an example using the flag."""
227
- for example_path, example_query, is_example in examples:
228
- if example_path == image_path and example_query == query:
229
  return is_example
230
  return False
231
 
@@ -233,7 +233,7 @@ def build_demo(embed_mode, concurrency_count=1):
233
  examples=[[e[0], e[1]] for e in examples],
234
  inputs=[imagebox, textbox],
235
  outputs=[state_is_example_image],
236
- fn=check_if_example,
237
  examples_per_page=3
238
  )
239
 
 
222
  ["./examples/safari_google.png", "Click on search bar.", True],
223
  ]
224
 
225
+ def check_if_example(query):
226
+ """Check if the query matches an example."""
227
+ for _, example_query, is_example in examples:
228
+ if example_query == query:
229
  return is_example
230
  return False
231
 
 
233
  examples=[[e[0], e[1]] for e in examples],
234
  inputs=[imagebox, textbox],
235
  outputs=[state_is_example_image],
236
+ fn=lambda img, query: check_if_example(query),
237
  examples_per_page=3
238
  )
239