hide embeddings text
Browse files
app.py
CHANGED
@@ -87,6 +87,14 @@ def is_prompt_embeddings(prompt):
|
|
87 |
except Exception as e:
|
88 |
return False
|
89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
def safe_url(url):
|
91 |
import urllib.parse
|
92 |
url = urllib.parse.quote(url, safe=':/')
|
@@ -307,6 +315,11 @@ test_images_urls = [
|
|
307 |
"https://i.pinimg.com/236x/11/c4/51/11c4518febb0869bd2b2d391d0753f44.jpg",
|
308 |
]
|
309 |
|
|
|
|
|
|
|
|
|
|
|
310 |
tabbed_examples = {
|
311 |
"Pups": {
|
312 |
"Pup1": "pup1.jpg",
|
@@ -317,8 +330,8 @@ tabbed_examples = {
|
|
317 |
"Pup5": "pup5.jpg",
|
318 |
},
|
319 |
"Embeddings": {
|
320 |
-
"Black & White": "
|
321 |
-
"Fire": "
|
322 |
},
|
323 |
"Portraits": {
|
324 |
"Snoop": "Snoop Dogg.jpg",
|
@@ -476,6 +489,8 @@ A tool for exploring CLIP embedding space.
|
|
476 |
debug_print("on_prompt_change")
|
477 |
if is_prompt_embeddings(prompt):
|
478 |
embeddings_b64 = prompt
|
|
|
|
|
479 |
else:
|
480 |
embeddings_b64 = on_prompt_change_update_embeddings(prompt)
|
481 |
new_plot = on_embeddings_changed_update_plot(embeddings_b64)
|
|
|
87 |
except Exception as e:
|
88 |
return False
|
89 |
|
90 |
+
def is_prompt_in_example_embeddings(prompt):
|
91 |
+
keys = example_embeddings.keys()
|
92 |
+
if prompt is None or prompt == "":
|
93 |
+
return False
|
94 |
+
if prompt in keys:
|
95 |
+
return True
|
96 |
+
return False
|
97 |
+
|
98 |
def safe_url(url):
|
99 |
import urllib.parse
|
100 |
url = urllib.parse.quote(url, safe=':/')
|
|
|
315 |
"https://i.pinimg.com/236x/11/c4/51/11c4518febb0869bd2b2d391d0753f44.jpg",
|
316 |
]
|
317 |
|
318 |
+
example_embeddings = {
|
319 |
+
"#Black & White embeddings": "F0kxPHAqE7t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yTzazhw9sFSuPCEI3ru4_wq9QrHNPDwZDTz5UTK9DS02vYLw2jy_qh09v1syPNP6Ur0HMwu9HVpcvVgU57wdNJY8uvy_PO6AezxBPK68vHG7vEHahLvnr7S9DAcCvdWCerz9Es67lB25vO-T8bsUFJq84oyTvV8O5TsCIzG7gcrKPH5rkLvQrsQ8KaCOvCXJ1bsmBQO9XP4nPesle71QMJi8qm0Uu8YZTb3nwjw9C2lzvOSyI7xXPcI8sHp0PZZDk7xvUQS9-cZRPZCC0TvoERY9mrVVPOvS-Twez_u72jA0vSo74rwOQCy7nrIMvYcA4juuzKq8C0MJPXRLbj2yjU88FMUuvSv_bD3_1pC9yfAXva_yOj2tCKC769JePRF5DjzIixi9gBl-Pe-8KD0G5Ci9Cc7DPKxEJz1grJc9La4KvaERWb1nppU7rd_oPDdFn7yatag8HSnDvIxfDD0VTcQ83_EHPeBmJ709LCe99qOMvApDP72cAfa8YCHbPGpBITpXsuG8qfiGvKNzBD2QXAI9o5luvXGKijzaQ_K8R5h5PVJpjLug_mI9ZVfyPC_WAT0AI3m9",
|
321 |
+
}
|
322 |
+
|
323 |
tabbed_examples = {
|
324 |
"Pups": {
|
325 |
"Pup1": "pup1.jpg",
|
|
|
330 |
"Pup5": "pup5.jpg",
|
331 |
},
|
332 |
"Embeddings": {
|
333 |
+
"Black & White": "#Black & White embeddings",
|
334 |
+
"Fire": "#Fire embeddings",
|
335 |
},
|
336 |
"Portraits": {
|
337 |
"Snoop": "Snoop Dogg.jpg",
|
|
|
489 |
debug_print("on_prompt_change")
|
490 |
if is_prompt_embeddings(prompt):
|
491 |
embeddings_b64 = prompt
|
492 |
+
elif is_prompt_in_example_embeddings(prompt):
|
493 |
+
embeddings_b64 = example_embeddings[prompt]
|
494 |
else:
|
495 |
embeddings_b64 = on_prompt_change_update_embeddings(prompt)
|
496 |
new_plot = on_embeddings_changed_update_plot(embeddings_b64)
|