Vivien
commited on
Commit
·
ff968d5
1
Parent(s):
1b0b2b9
Change layout
Browse files
app.py
CHANGED
|
@@ -46,7 +46,10 @@ def image_search(query, corpus, n_results=24):
|
|
| 46 |
|
| 47 |
description = '''
|
| 48 |
# Semantic image search
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
'''
|
| 51 |
|
| 52 |
def main():
|
|
@@ -55,8 +58,15 @@ def main():
|
|
| 55 |
.block-container{
|
| 56 |
max-width: 1200px;
|
| 57 |
}
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
#MainMenu {
|
| 62 |
visibility: hidden;
|
|
@@ -67,11 +77,9 @@ def main():
|
|
| 67 |
</style>''',
|
| 68 |
unsafe_allow_html=True)
|
| 69 |
st.sidebar.markdown(description)
|
| 70 |
-
_,
|
| 71 |
-
query =
|
| 72 |
-
|
| 73 |
-
col2.text('')
|
| 74 |
-
corpus = col2.radio('', ["Unsplash","Movies"])
|
| 75 |
if len(query) > 0:
|
| 76 |
results = image_search(query, corpus)
|
| 77 |
st.markdown(get_html(results), unsafe_allow_html=True)
|
|
|
|
| 46 |
|
| 47 |
description = '''
|
| 48 |
# Semantic image search
|
| 49 |
+
|
| 50 |
+
**Enter your query and hit enter**
|
| 51 |
+
|
| 52 |
+
*Built with OpenAI's [CLIP](https://openai.com/blog/clip/) model, 🤗 Hugging Face's [transformers library](https://huggingface.co/transformers/), [Streamlit](https://streamlit.io/) and images from [Unsplash](https://unsplash.com/) and [The Movie Database (TMDB)](https://www.themoviedb.org/)*
|
| 53 |
'''
|
| 54 |
|
| 55 |
def main():
|
|
|
|
| 58 |
.block-container{
|
| 59 |
max-width: 1200px;
|
| 60 |
}
|
| 61 |
+
div.row-widget.stRadio > div{
|
| 62 |
+
margin-top: -30px;
|
| 63 |
+
flex-direction:row;
|
| 64 |
+
display: flex;
|
| 65 |
+
justify-content: center;
|
| 66 |
+
}
|
| 67 |
+
div.row-widget.stRadio > div > label{
|
| 68 |
+
margin-left: 5px;
|
| 69 |
+
margin-right: 5px;
|
| 70 |
}
|
| 71 |
#MainMenu {
|
| 72 |
visibility: hidden;
|
|
|
|
| 77 |
</style>''',
|
| 78 |
unsafe_allow_html=True)
|
| 79 |
st.sidebar.markdown(description)
|
| 80 |
+
_, c, _ = st.beta_columns((1, 3, 1))
|
| 81 |
+
query = c.text_input('')
|
| 82 |
+
corpus = st.radio('', ["Unsplash","Movies"])
|
|
|
|
|
|
|
| 83 |
if len(query) > 0:
|
| 84 |
results = image_search(query, corpus)
|
| 85 |
st.markdown(get_html(results), unsafe_allow_html=True)
|