mg643 commited on
Commit
fee0793
·
2 Parent(s): c550680a8d63af

Merge branch 'main' into han_result_dashboard

Browse files
Files changed (2) hide show
  1. main.py +12 -5
  2. requirements.txt +1 -1
main.py CHANGED
@@ -1,13 +1,19 @@
1
  import streamlit as st
2
- import met_api
3
  import pandas as pd
4
-
5
- from met_api import search_for_images
6
 
7
  @st.cache_data
8
  def cached_search_for_images(query):
9
  return search_for_images(query, 2,departments=[1,3,4,5,6,7])
10
 
 
 
 
 
 
 
 
 
11
  # Page setup
12
  st.set_page_config(page_title="The METrics", layout="centered")
13
 
@@ -41,6 +47,7 @@ st.markdown(
41
  unsafe_allow_html=True
42
  )
43
 
 
44
  # Columns with fixed-height images
45
  col1, col2, col3 = st.columns(3)
46
 
@@ -87,7 +94,7 @@ st.write("")
87
  # Search bar
88
  st.markdown("""
89
  <div style='display: flex; justify-content: center;'>
90
- <input type="text" placeholder=" 🔎 Search Met's Art Collection...."
91
  style="padding: 10px; width: 250px; border-radius: 20px; border: 1px solid #ccc;">
92
  </div>
93
  """, unsafe_allow_html=True)
@@ -116,7 +123,7 @@ st.write("")
116
  # Footer
117
  st.markdown("""
118
  <div style='position: fixed; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 12px;'>
119
- <span style="font-size: 14px;">ℹ️ Met API and data related information is available at –
120
  <a href="https://metmuseum.github.io/" target="_blank">https://metmuseum.github.io/</a></span>
121
  </div>
122
  """, unsafe_allow_html=True)
 
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):
7
  return search_for_images(query, 2,departments=[1,3,4,5,6,7])
8
 
9
+ @st.cache_data
10
+ def cache_objectsWithImages():
11
+ return get_objectsWithImages()
12
+
13
+ @st.cache_data
14
+ def cache_images(total, objectIDs, limit):
15
+ return get_images(total, objectIDs, limit)
16
+
17
  # Page setup
18
  st.set_page_config(page_title="The METrics", layout="centered")
19
 
 
47
  unsafe_allow_html=True
48
  )
49
 
50
+
51
  # Columns with fixed-height images
52
  col1, col2, col3 = st.columns(3)
53
 
 
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)
 
123
  # Footer
124
  st.markdown("""
125
  <div style='position: fixed; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 12px;'>
126
+ <span style="font-size: 14px;">ℹ️ Met API and data related information is available at –
127
  <a href="https://metmuseum.github.io/" target="_blank">https://metmuseum.github.io/</a></span>
128
  </div>
129
  """, unsafe_allow_html=True)
requirements.txt CHANGED
@@ -1,3 +1,3 @@
1
  streamlit==1.48.1
2
  pandas
3
- requests
 
1
  streamlit==1.48.1
2
  pandas
3
+ requests==2.32.5