Spaces:
Sleeping
Sleeping
tensorkelechi
commited on
Commit
•
0b253de
1
Parent(s):
dc3bcae
Update app.py
Browse files
app.py
CHANGED
@@ -52,7 +52,7 @@ def init_search(_embedded_data, _embedder):
|
|
52 |
stl.success("Initialized text search class")
|
53 |
return text_search
|
54 |
|
55 |
-
def get_images_from_description(description):
|
56 |
scores, ret_images = finder.get_similar_images(description, k_images=4)
|
57 |
return scores, ret_images
|
58 |
|
@@ -64,12 +64,13 @@ if dataset and stl.button("embed image dataset"):
|
|
64 |
|
65 |
if embedded_data and embedder:
|
66 |
finder = init_search(embedded_data, embedder)
|
67 |
-
|
|
|
68 |
search_term = stl.text_input("Text description/search for image")
|
69 |
|
70 |
if search_term is not None:
|
71 |
with stl.spinner("retrieving images with description.."):
|
72 |
-
scores, ret_images = get_images_from_description(search_term)
|
73 |
stl.success(f"sucessfully retrieved {len(ret_images)} images")
|
74 |
|
75 |
try:
|
|
|
52 |
stl.success("Initialized text search class")
|
53 |
return text_search
|
54 |
|
55 |
+
def get_images_from_description(finder, description):
|
56 |
scores, ret_images = finder.get_similar_images(description, k_images=4)
|
57 |
return scores, ret_images
|
58 |
|
|
|
64 |
|
65 |
if embedded_data and embedder:
|
66 |
finder = init_search(embedded_data, embedder)
|
67 |
+
|
68 |
+
|
69 |
search_term = stl.text_input("Text description/search for image")
|
70 |
|
71 |
if search_term is not None:
|
72 |
with stl.spinner("retrieving images with description.."):
|
73 |
+
scores, ret_images = get_images_from_description(finder, search_term)
|
74 |
stl.success(f"sucessfully retrieved {len(ret_images)} images")
|
75 |
|
76 |
try:
|