Spaces:
Sleeping
Sleeping
Fangrui Liu
commited on
Commit
·
b73f599
1
Parent(s):
725da8c
fixed uploade name bug
Browse files
app.py
CHANGED
|
@@ -352,7 +352,7 @@ if 'xq' not in st.session_state:
|
|
| 352 |
prompt = start[2].text_input(
|
| 353 |
"Prompt:", value="", placeholder="Examples: playing corgi, 女人举着雨伞, mouette volant au-dessus de la mer, ガラスの花瓶の花 ...")
|
| 354 |
if len(prompt) > 0:
|
| 355 |
-
st.session_state.prompt = prompt
|
| 356 |
start[3].markdown(
|
| 357 |
'<p style="color:gray;"> Don\'t know what to search? Try <b>Random</b>!</p>\
|
| 358 |
<p>🌟 We also support multi-language search. Type any language you know to search! ⌨️ </p>',
|
|
@@ -384,6 +384,7 @@ if 'xq' not in st.session_state:
|
|
| 384 |
assert len(weights) == 1
|
| 385 |
xq = numpy_helper.to_array(weights[0]).tolist()
|
| 386 |
assert len(xq) == DIMS
|
|
|
|
| 387 |
else:
|
| 388 |
print(f"Input prompt is {prompt}")
|
| 389 |
# Tokenize the vectors
|
|
@@ -432,7 +433,7 @@ if 'xq' in st.session_state:
|
|
| 432 |
st.markdown(card_with_conf(i, dist, url),
|
| 433 |
unsafe_allow_html=True)
|
| 434 |
dnld_nam = st.text_input('Download Name:',
|
| 435 |
-
f'{(st.session_state.prompt if "prompt" in st.session_state else
|
| 436 |
max_chars=50)
|
| 437 |
dnld_btn = st.download_button('Download your classifier!',
|
| 438 |
st.session_state.dnld_model,
|
|
|
|
| 352 |
prompt = start[2].text_input(
|
| 353 |
"Prompt:", value="", placeholder="Examples: playing corgi, 女人举着雨伞, mouette volant au-dessus de la mer, ガラスの花瓶の花 ...")
|
| 354 |
if len(prompt) > 0:
|
| 355 |
+
st.session_state.prompt = prompt.replace(' ', '_')
|
| 356 |
start[3].markdown(
|
| 357 |
'<p style="color:gray;"> Don\'t know what to search? Try <b>Random</b>!</p>\
|
| 358 |
<p>🌟 We also support multi-language search. Type any language you know to search! ⌨️ </p>',
|
|
|
|
| 384 |
assert len(weights) == 1
|
| 385 |
xq = numpy_helper.to_array(weights[0]).tolist()
|
| 386 |
assert len(xq) == DIMS
|
| 387 |
+
st.session_state.prompt = upld_model.name.split(".onnx")[0].replace(' ', '_')
|
| 388 |
else:
|
| 389 |
print(f"Input prompt is {prompt}")
|
| 390 |
# Tokenize the vectors
|
|
|
|
| 433 |
st.markdown(card_with_conf(i, dist, url),
|
| 434 |
unsafe_allow_html=True)
|
| 435 |
dnld_nam = st.text_input('Download Name:',
|
| 436 |
+
f'{(st.session_state.prompt if "prompt" in st.session_state else "model")}.onnx',
|
| 437 |
max_chars=50)
|
| 438 |
dnld_btn = st.download_button('Download your classifier!',
|
| 439 |
st.session_state.dnld_model,
|