mtoft20 commited on
Commit
c724814
·
verified ·
1 Parent(s): 7e46f8f

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +5 -5
src/streamlit_app.py CHANGED
@@ -266,10 +266,10 @@ def get_similar_content(content, n_recommendations=5):
266
  clean_title = re.sub(r'\s*\(\d{4}\)\s*$', '', title)
267
  st.write(f"🔍 Searching for similar content to: {clean_title}")
268
 
269
- # URLs for both similarity tables
270
  similarity_table_urls = [
271
- "https://mtoft20-potm.hf.space/api/v1/db/data/noco/p9pozkcw81t9aee/mtsx4yp45gi12tm",
272
- "https://mtoft20-potm.hf.space/api/v1/db/data/noco/p9pozkcw81t9aee/mca47f9wyoubouk"
273
  ]
274
 
275
  similar_items = []
@@ -278,7 +278,7 @@ def get_similar_content(content, n_recommendations=5):
278
  for table_url in similarity_table_urls:
279
  # Case-insensitive title match
280
  params = {
281
- "where": f"(title,like,\"{clean_title}\")"
282
  }
283
 
284
  # Debug: Print the request details
@@ -315,7 +315,7 @@ def get_similar_content(content, n_recommendations=5):
315
  for item in similar_items:
316
  # Query main content table for full details
317
  content_params = {
318
- "where": f"(title,like,\"{item['title']}\")"
319
  }
320
  content_response = requests.get(NOCODB_URL, headers=headers, params=content_params)
321
 
 
266
  clean_title = re.sub(r'\s*\(\d{4}\)\s*$', '', title)
267
  st.write(f"🔍 Searching for similar content to: {clean_title}")
268
 
269
+ # URLs for both similarity tables - using the correct table names
270
  similarity_table_urls = [
271
+ "https://mtoft20-potm.hf.space/api/v1/db/data/noco/p9pozkcw81t9aee/content_similarities_part_1_csv",
272
+ "https://mtoft20-potm.hf.space/api/v1/db/data/noco/p9pozkcw81t9aee/content_similarities_part_2_csv"
273
  ]
274
 
275
  similar_items = []
 
278
  for table_url in similarity_table_urls:
279
  # Case-insensitive title match
280
  params = {
281
+ "where": f"(title,eq,\"{clean_title}\")" # Changed back to eq for exact match
282
  }
283
 
284
  # Debug: Print the request details
 
315
  for item in similar_items:
316
  # Query main content table for full details
317
  content_params = {
318
+ "where": f"(title,eq,\"{item['title']}\")" # Changed back to eq for exact match
319
  }
320
  content_response = requests.get(NOCODB_URL, headers=headers, params=content_params)
321