CCockrum commited on
Commit
b948611
·
verified ·
1 Parent(s): 0b93d55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -14,21 +14,22 @@ 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
  # 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
 
 
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
  # Updated collection URLs using the correct LOC API format
19
  collections = {
20
+ "American Revolutionary War Maps": "american+revolutionary+war+maps",
21
+ "Civil War Maps": "civil+war+maps",
22
+ "Women's Suffrage": "women+suffrage",
23
+ "World War I Posters": "world+war+posters"
24
  }
25
 
26
  # Sidebar for selecting collection
27
  st.sidebar.markdown("## Settings")
28
  selected = st.sidebar.selectbox("Select a collection", list(collections.keys()))
29
+ search_query = collections[selected]
30
 
31
+ # Use the main search endpoint (most reliable)
32
+ collection_url = f"https://www.loc.gov/search/?q={search_query}&fo=json"
33
  st.sidebar.write(f"Selected Collection: {selected}")
34
  st.sidebar.write(f"API URL: {collection_url}")
35