CCockrum commited on
Commit
a4af329
·
verified ·
1 Parent(s): 3af188f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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
- # Predefined LOC collections
18
  collections = {
19
- "American Revolutionary War Maps": "american-revolutionary-war-maps",
20
- "Civil War Maps": "civil-war-maps",
21
- "Women's Suffrage": "womens-suffrage",
22
- "World War I Posters": "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_path = collections[selected]
29
 
30
- # Corrected LOC API URL format
31
- collection_url = f"https://www.loc.gov/{collection_path}/?fo=json"
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