Spaces:
Sleeping
Sleeping
Relative import fix, removed redundant search bar
Browse files
main.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
-
from met_api import search_for_images, get_objectsWithImages, get_images
|
| 4 |
|
| 5 |
@st.cache_data
|
| 6 |
def cached_search_for_images(query):
|
|
@@ -51,7 +51,7 @@ st.markdown(
|
|
| 51 |
# Columns with fixed-height images
|
| 52 |
col1, col2, col3 = st.columns(3)
|
| 53 |
|
| 54 |
-
q = st.text_input("Search
|
| 55 |
|
| 56 |
r = cached_search_for_images(q)
|
| 57 |
|
|
@@ -91,13 +91,6 @@ with col3:
|
|
| 91 |
|
| 92 |
st.write("")
|
| 93 |
st.write("")
|
| 94 |
-
# Search bar
|
| 95 |
-
st.markdown("""
|
| 96 |
-
<div style='display: flex; justify-content: center;'>
|
| 97 |
-
<input type="text" placeholder=" 🔎 Search Met's Art Collection...."
|
| 98 |
-
style="padding: 10px; width: 250px; border-radius: 20px; border: 1px solid #ccc;">
|
| 99 |
-
</div>
|
| 100 |
-
""", unsafe_allow_html=True)
|
| 101 |
|
| 102 |
# Department analytic
|
| 103 |
st.write("")
|
|
@@ -108,7 +101,7 @@ max_ids = st.slider("How many results to analyze", 20, 400, 150, 10, key="dept_m
|
|
| 108 |
|
| 109 |
if st.button("Run department analytic", key="dept_run"):
|
| 110 |
with st.spinner("Fetching and tallying departments…"):
|
| 111 |
-
rows =
|
| 112 |
|
| 113 |
if not rows:
|
| 114 |
st.info("No results found (or the API call failed). Try another term.")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
+
from met_api import search_for_images, get_objectsWithImages, get_images, department_counts
|
| 4 |
|
| 5 |
@st.cache_data
|
| 6 |
def cached_search_for_images(query):
|
|
|
|
| 51 |
# Columns with fixed-height images
|
| 52 |
col1, col2, col3 = st.columns(3)
|
| 53 |
|
| 54 |
+
q = st.text_input("🔎 Search Met's Art Collection....",value="UFO", key="search_query")
|
| 55 |
|
| 56 |
r = cached_search_for_images(q)
|
| 57 |
|
|
|
|
| 91 |
|
| 92 |
st.write("")
|
| 93 |
st.write("")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
# Department analytic
|
| 96 |
st.write("")
|
|
|
|
| 101 |
|
| 102 |
if st.button("Run department analytic", key="dept_run"):
|
| 103 |
with st.spinner("Fetching and tallying departments…"):
|
| 104 |
+
rows = department_counts(q=query, max_ids=max_ids)
|
| 105 |
|
| 106 |
if not rows:
|
| 107 |
st.info("No results found (or the API call failed). Try another term.")
|