Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,21 +14,21 @@ This tool connects to the LOC API, retrieves metadata from a selected collection
|
|
14 |
an analysis of metadata completeness, suggests enhancements, and identifies authority gaps.
|
15 |
""")
|
16 |
|
17 |
-
#
|
18 |
collections = {
|
19 |
-
"American Revolutionary War Maps": "american
|
20 |
-
"Civil War Maps": "civil
|
21 |
-
"Women's Suffrage": "
|
22 |
-
"World War I Posters": "world
|
23 |
}
|
24 |
|
25 |
# Sidebar for selecting collection
|
26 |
st.sidebar.markdown("## Settings")
|
27 |
selected = st.sidebar.selectbox("Select a collection", list(collections.keys()))
|
28 |
-
|
29 |
|
30 |
-
#
|
31 |
-
collection_url = f"https://www.loc.gov/{
|
32 |
st.sidebar.write(f"Selected Collection: {selected}")
|
33 |
st.sidebar.write(f"API URL: {collection_url}")
|
34 |
|
|
|
14 |
an analysis of metadata completeness, suggests enhancements, and identifies authority gaps.
|
15 |
""")
|
16 |
|
17 |
+
# Updated collection URLs using the correct LOC API format
|
18 |
collections = {
|
19 |
+
"American Revolutionary War Maps": {"path": "maps", "query": "american+revolutionary+war"},
|
20 |
+
"Civil War Maps": {"path": "maps", "query": "civil+war"},
|
21 |
+
"Women's Suffrage": {"path": "collection", "query": "women+suffrage"},
|
22 |
+
"World War I Posters": {"path": "pictures", "query": "world+war+I+posters"}
|
23 |
}
|
24 |
|
25 |
# Sidebar for selecting collection
|
26 |
st.sidebar.markdown("## Settings")
|
27 |
selected = st.sidebar.selectbox("Select a collection", list(collections.keys()))
|
28 |
+
collection_info = collections[selected]
|
29 |
|
30 |
+
# Correct URL format for LOC API
|
31 |
+
collection_url = f"https://www.loc.gov/{collection_info['path']}/search/?q={collection_info['query']}&fo=json"
|
32 |
st.sidebar.write(f"Selected Collection: {selected}")
|
33 |
st.sidebar.write(f"API URL: {collection_url}")
|
34 |
|