Spaces:
Runtime error
Runtime error
fix: no double spinner
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ st.title("VitB32 Bert Ko Small Clip Test")
|
|
10 |
st.markdown("Unsplash data์์ ์
๋ ฅ ํ
์คํธ์ ๊ฐ์ฅ ์ ์ฌํ ์ด๋ฏธ์ง๋ฅผ ๊ฒ์ํฉ๋๋ค.")
|
11 |
|
12 |
|
13 |
-
@st.cache(allow_output_mutation=True)
|
14 |
def get_model():
|
15 |
with st.spinner("Loading model..."):
|
16 |
model = VisionTextDualEncoderModel.from_pretrained(
|
@@ -31,9 +31,7 @@ img_emb = np.load("img_emb.npy")
|
|
31 |
|
32 |
text = st.text_input("Input Text", value="๊ฒ์ ๊ณ ์์ด")
|
33 |
tokens = processor(text=text, return_tensors="pt")
|
34 |
-
|
35 |
-
with st.spinner("Predicting..."):
|
36 |
-
text_emb = model.get_text_features(**tokens)
|
37 |
|
38 |
result = semantic_search(text_emb, img_emb, top_k=15)[0]
|
39 |
_result = iter(result)
|
|
|
10 |
st.markdown("Unsplash data์์ ์
๋ ฅ ํ
์คํธ์ ๊ฐ์ฅ ์ ์ฌํ ์ด๋ฏธ์ง๋ฅผ ๊ฒ์ํฉ๋๋ค.")
|
11 |
|
12 |
|
13 |
+
@st.cache(allow_output_mutation=True, show_spinner=False)
|
14 |
def get_model():
|
15 |
with st.spinner("Loading model..."):
|
16 |
model = VisionTextDualEncoderModel.from_pretrained(
|
|
|
31 |
|
32 |
text = st.text_input("Input Text", value="๊ฒ์ ๊ณ ์์ด")
|
33 |
tokens = processor(text=text, return_tensors="pt")
|
34 |
+
text_emb = model.get_text_features(**tokens)
|
|
|
|
|
35 |
|
36 |
result = semantic_search(text_emb, img_emb, top_k=15)[0]
|
37 |
_result = iter(result)
|