Update app.py
Browse files
app.py
CHANGED
|
@@ -222,11 +222,13 @@ def build_demo(embed_mode, concurrency_count=1):
|
|
| 222 |
["./examples/safari_google.png", "Click on search bar."],
|
| 223 |
]
|
| 224 |
|
| 225 |
-
def set_example_flag(
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
|
|
|
|
|
|
| 230 |
|
| 231 |
gr.Examples(
|
| 232 |
examples=examples,
|
|
@@ -298,4 +300,4 @@ if __name__ == "__main__":
|
|
| 298 |
server_port=7860,
|
| 299 |
ssr_mode=False,
|
| 300 |
debug=True,
|
| 301 |
-
)
|
|
|
|
| 222 |
["./examples/safari_google.png", "Click on search bar."],
|
| 223 |
]
|
| 224 |
|
| 225 |
+
def set_example_flag(image_array, query):
|
| 226 |
+
image = Image.fromarray(np.uint8(image_array))
|
| 227 |
+
for example_path, _ in examples:
|
| 228 |
+
example_image = Image.open(example_path)
|
| 229 |
+
if np.array_equal(np.array(image), np.array(example_image)):
|
| 230 |
+
return True
|
| 231 |
+
return False
|
| 232 |
|
| 233 |
gr.Examples(
|
| 234 |
examples=examples,
|
|
|
|
| 300 |
server_port=7860,
|
| 301 |
ssr_mode=False,
|
| 302 |
debug=True,
|
| 303 |
+
)
|