nicolasb92 commited on
Commit
51b2216
·
1 Parent(s): 99d12ec

devcontainer and fix

Browse files
Files changed (2) hide show
  1. .devcontainer/devcontainer.json +3 -0
  2. app.py +6 -3
.devcontainer/devcontainer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ec2f9a25b0bf0be971d8cb0a42ccc22331a1694a049f9841fb26ed07c13f404
3
+ size 1039
app.py CHANGED
@@ -33,7 +33,7 @@ parsed_structure_info = {
33
  }
34
 
35
  # Load the docstore
36
- data_dir = Path(__file__).parents[1] / "data"
37
  docstore = SimpleDocumentStore.from_persist_path(str(data_dir / "storage_metadata" / "processed_docstore_storage.json"))
38
 
39
 
@@ -122,8 +122,11 @@ def server(input, output, session):
122
  if not doc:
123
  logger.error(f"Document not found: {input.selected_doc_id()}")
124
  return ui.p("Error: Document not found")
125
-
126
- pdf_path = doc.metadata.get("file_path")
 
 
 
127
  pdf_data_url = get_pdf_data_url(pdf_path) if pdf_path else None
128
 
129
  return ui.div(
 
33
  }
34
 
35
  # Load the docstore
36
+ data_dir = Path(__file__).parent / "data"
37
  docstore = SimpleDocumentStore.from_persist_path(str(data_dir / "storage_metadata" / "processed_docstore_storage.json"))
38
 
39
 
 
122
  if not doc:
123
  logger.error(f"Document not found: {input.selected_doc_id()}")
124
  return ui.p("Error: Document not found")
125
+ filename = doc.metadata.get("filename", "")
126
+ if not filename:
127
+ logger.error(f"Document does not have a filename: {input.selected_doc_id()}")
128
+ return ui.p("Error: Document does not have a filename")
129
+ pdf_path = data_dir / "pdfs" / filename
130
  pdf_data_url = get_pdf_data_url(pdf_path) if pdf_path else None
131
 
132
  return ui.div(