Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -90,14 +90,13 @@ st.sidebar.markdown("## Settings")
|
|
90 |
selected = st.sidebar.selectbox("Select a collection", list(collections.keys()))
|
91 |
search_query = collections[selected]
|
92 |
|
93 |
-
|
|
|
94 |
|
95 |
# Display API URL
|
96 |
st.sidebar.write(f"Selected Collection: {selected}")
|
97 |
st.sidebar.markdown(f"<span style='color: lightgray;'>API URL: {collection_url}</span>", unsafe_allow_html=True)
|
98 |
|
99 |
-
|
100 |
-
|
101 |
# Fetch data from LOC API with spoofed User-Agent header
|
102 |
headers = {
|
103 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/110.0.0.0 Safari/537.36"
|
@@ -210,4 +209,4 @@ if not metadata_df.empty:
|
|
210 |
else:
|
211 |
st.info("Not enough descriptive data to generate metadata suggestions.")
|
212 |
else:
|
213 |
-
st.warning("No metadata records found for this collection. Try selecting another one.")
|
|
|
90 |
selected = st.sidebar.selectbox("Select a collection", list(collections.keys()))
|
91 |
search_query = collections[selected]
|
92 |
|
93 |
+
# Define the collection URL
|
94 |
+
collection_url = f"https://www.loc.gov/search/?q={search_query}&fo=json"
|
95 |
|
96 |
# Display API URL
|
97 |
st.sidebar.write(f"Selected Collection: {selected}")
|
98 |
st.sidebar.markdown(f"<span style='color: lightgray;'>API URL: {collection_url}</span>", unsafe_allow_html=True)
|
99 |
|
|
|
|
|
100 |
# Fetch data from LOC API with spoofed User-Agent header
|
101 |
headers = {
|
102 |
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/110.0.0.0 Safari/537.36"
|
|
|
209 |
else:
|
210 |
st.info("Not enough descriptive data to generate metadata suggestions.")
|
211 |
else:
|
212 |
+
st.warning("No metadata records found for this collection. Try selecting another one.")
|