cryogenic22 commited on
Commit
2ffb05f
·
verified ·
1 Parent(s): 31a3df4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -172,11 +172,14 @@ def main():
172
  )
173
 
174
  # Handle file upload
 
175
  if uploaded_file:
176
  with st.spinner("Processing document..."):
177
  try:
178
  # Process the uploaded file using DocumentProcessor
179
  text, chunks, metadata = doc_processor.process_and_tag_document(uploaded_file)
 
 
180
  doc_data = {
181
  "id": metadata['doc_id'],
182
  "title": uploaded_file.name,
@@ -184,11 +187,13 @@ def main():
184
  "metadata": metadata,
185
  "chunks": chunks
186
  }
 
187
  # Add the document to the case
188
  case_manager.add_document(case["id"], doc_data)
189
  st.success(f"Document '{uploaded_file.name}' added successfully!")
190
  except Exception as e:
191
  st.error(f"Error processing document: {str(e)}")
 
192
  else:
193
  st.info("No cases created yet. Use the form above to create your first case.")
194
  except Exception as e:
 
172
  )
173
 
174
  # Handle file upload
175
+
176
  if uploaded_file:
177
  with st.spinner("Processing document..."):
178
  try:
179
  # Process the uploaded file using DocumentProcessor
180
  text, chunks, metadata = doc_processor.process_and_tag_document(uploaded_file)
181
+
182
+ # Prepare document data
183
  doc_data = {
184
  "id": metadata['doc_id'],
185
  "title": uploaded_file.name,
 
187
  "metadata": metadata,
188
  "chunks": chunks
189
  }
190
+
191
  # Add the document to the case
192
  case_manager.add_document(case["id"], doc_data)
193
  st.success(f"Document '{uploaded_file.name}' added successfully!")
194
  except Exception as e:
195
  st.error(f"Error processing document: {str(e)}")
196
+
197
  else:
198
  st.info("No cases created yet. Use the form above to create your first case.")
199
  except Exception as e: