Vivien
commited on
Commit
•
3e50eda
1
Parent(s):
9033a8d
Keep 1 model (several leading to memory errors)
Browse files
app.py
CHANGED
@@ -6,10 +6,11 @@ from transformers import CLIPProcessor, CLIPModel
|
|
6 |
from st_clickable_images import clickable_images
|
7 |
|
8 |
MODEL_NAMES = [
|
9 |
-
"base-patch32",
|
10 |
-
"base-patch16",
|
11 |
-
"large-patch14
|
12 |
-
|
|
|
13 |
|
14 |
|
15 |
@st.cache(allow_output_mutation=True)
|
@@ -157,9 +158,9 @@ def main():
|
|
157 |
st.sidebar.markdown(description)
|
158 |
with st.sidebar.expander("Advanced use"):
|
159 |
st.markdown(howto)
|
160 |
-
mode = st.sidebar.selectbox(
|
161 |
-
|
162 |
-
)
|
163 |
|
164 |
_, c, _ = st.columns((1, 3, 1))
|
165 |
if "query" in st.session_state:
|
@@ -175,7 +176,7 @@ def main():
|
|
175 |
"ViT-L/14@336px (slower)": "large-patch14-336",
|
176 |
}
|
177 |
|
178 |
-
if "Comparison" in mode:
|
179 |
c1, c2 = st.columns((1, 1))
|
180 |
selection1 = c1.selectbox("", models_dict.keys(), index=0)
|
181 |
selection2 = c2.selectbox("", models_dict.keys(), index=2)
|
@@ -186,7 +187,7 @@ def main():
|
|
186 |
|
187 |
if len(query) > 0:
|
188 |
results1 = image_search(query, corpus, name1)
|
189 |
-
if "Comparison" in mode:
|
190 |
with c1:
|
191 |
clicked1 = clickable_images(
|
192 |
[result[0] for result in results1],
|
@@ -224,8 +225,8 @@ def main():
|
|
224 |
if change_query:
|
225 |
if clicked1 >= 0:
|
226 |
st.session_state["query"] = f"[{corpus}:{results1[clicked1][2]}]"
|
227 |
-
elif clicked2 >= 0:
|
228 |
-
|
229 |
st.experimental_rerun()
|
230 |
|
231 |
|
|
|
6 |
from st_clickable_images import clickable_images
|
7 |
|
8 |
MODEL_NAMES = [
|
9 |
+
# "base-patch32",
|
10 |
+
# "base-patch16",
|
11 |
+
# "large-patch14",
|
12 |
+
"large-patch14-336"
|
13 |
+
]
|
14 |
|
15 |
|
16 |
@st.cache(allow_output_mutation=True)
|
|
|
158 |
st.sidebar.markdown(description)
|
159 |
with st.sidebar.expander("Advanced use"):
|
160 |
st.markdown(howto)
|
161 |
+
#mode = st.sidebar.selectbox(
|
162 |
+
# "", ["Results for ViT-L/14@336px", "Comparison of 2 models"], index=0
|
163 |
+
#)
|
164 |
|
165 |
_, c, _ = st.columns((1, 3, 1))
|
166 |
if "query" in st.session_state:
|
|
|
176 |
"ViT-L/14@336px (slower)": "large-patch14-336",
|
177 |
}
|
178 |
|
179 |
+
if False:#"Comparison" in mode:
|
180 |
c1, c2 = st.columns((1, 1))
|
181 |
selection1 = c1.selectbox("", models_dict.keys(), index=0)
|
182 |
selection2 = c2.selectbox("", models_dict.keys(), index=2)
|
|
|
187 |
|
188 |
if len(query) > 0:
|
189 |
results1 = image_search(query, corpus, name1)
|
190 |
+
if False:#"Comparison" in mode:
|
191 |
with c1:
|
192 |
clicked1 = clickable_images(
|
193 |
[result[0] for result in results1],
|
|
|
225 |
if change_query:
|
226 |
if clicked1 >= 0:
|
227 |
st.session_state["query"] = f"[{corpus}:{results1[clicked1][2]}]"
|
228 |
+
#elif clicked2 >= 0:
|
229 |
+
# st.session_state["query"] = f"[{corpus}:{results2[clicked2][2]}]"
|
230 |
st.experimental_rerun()
|
231 |
|
232 |
|