mtoft20 commited on
Commit
d60b4a5
Β·
verified Β·
1 Parent(s): 2291e59

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +20 -0
src/streamlit_app.py CHANGED
@@ -266,6 +266,15 @@ 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
  # Base URL for the NocoDB API
270
  base_url = "https://mtoft20-potm.hf.space/api/v1/db/data/noco/p9pozkcw81t9aee"
271
 
@@ -279,6 +288,17 @@ def get_similar_content(content, n_recommendations=5):
279
 
280
  # Check both tables for similarities
281
  for table_url in similarity_table_urls:
 
 
 
 
 
 
 
 
 
 
 
282
  # Using NocoDB's filter format with quotes around the title
283
  query = f'(title,eq,"{clean_title}")'
284
  params = {
 
266
  clean_title = re.sub(r'\s*\(\d{4}\)\s*$', '', title)
267
  st.write(f"πŸ” Searching for similar content to: {clean_title}")
268
 
269
+ # First verify the movie exists in the main content table
270
+ verify_params = {
271
+ "where": f'(title,eq,"{clean_title}")'
272
+ }
273
+ verify_response = requests.get(NOCODB_URL, headers=headers, params=verify_params)
274
+ if verify_response.status_code == 200:
275
+ verify_data = verify_response.json()
276
+ st.write(f"βœ… Found movie in main content table: {len(verify_data.get('list', []))} matches")
277
+
278
  # Base URL for the NocoDB API
279
  base_url = "https://mtoft20-potm.hf.space/api/v1/db/data/noco/p9pozkcw81t9aee"
280
 
 
288
 
289
  # Check both tables for similarities
290
  for table_url in similarity_table_urls:
291
+ # Debug: Get a sample row to see table structure
292
+ sample_params = {
293
+ "limit": 1
294
+ }
295
+ sample_response = requests.get(table_url, headers=headers, params=sample_params)
296
+ if sample_response.status_code == 200:
297
+ sample_data = sample_response.json()
298
+ if sample_data.get('list'):
299
+ st.write(f"πŸ“‹ Table structure for {table_url.split('/')[-1]}:")
300
+ st.write("Columns:", list(sample_data['list'][0].keys()))
301
+
302
  # Using NocoDB's filter format with quotes around the title
303
  query = f'(title,eq,"{clean_title}")'
304
  params = {