thechaiexperiment commited on
Commit
ce7d4b4
·
verified ·
1 Parent(s): f36a425

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -723,15 +723,18 @@ async def recipes_endpoint(profile: MedicalProfile):
723
  metadata_path = 'recipes_metadata.xlsx'
724
  metadata = retrieve_metadata(document_indices, metadata_path=metadata_path)
725
  print(f"Retrieved Metadata: {metadata}")
 
726
  recipes = []
727
  for item in metadata.values():
728
  recipes.append({
729
- "title": item.get("original_file_name", "Unknown Title"),
730
- "url": item.get("url", "")
731
- })
 
732
  response = {
733
- "recipes": recipes
734
- }
 
735
  return response
736
  except ValueError as ve:
737
  raise HTTPException(status_code=400, detail=str(ve))
 
723
  metadata_path = 'recipes_metadata.xlsx'
724
  metadata = retrieve_metadata(document_indices, metadata_path=metadata_path)
725
  print(f"Retrieved Metadata: {metadata}")
726
+ # Convert metadata dictionary to a list of recipe objects
727
  recipes = []
728
  for item in metadata.values():
729
  recipes.append({
730
+ "title": item["original_file_name"] if "original_file_name" in item else "Unknown Title",
731
+ "url": item["url"] if "url" in item else ""
732
+ })
733
+
734
  response = {
735
+ "recipes": recipes # Wrap the list of recipes in a dictionary with a 'recipes' key
736
+ }
737
+
738
  return response
739
  except ValueError as ve:
740
  raise HTTPException(status_code=400, detail=str(ve))