kpal002 commited on
Commit
ca30b63
·
verified ·
1 Parent(s): 4ef34bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -170,6 +170,9 @@ def process_pdf(uploaded_files, llm_model, n_criteria = num_criteria):
170
  output_files = []
171
  for i, uploaded_file in enumerate(uploaded_files):
172
  # Process the PDF file
 
 
 
173
  pdf_processor = PDFProcessor_Unstructured(pdf_processing_config)
174
  merged_chunks, tables, title = pdf_processor.process_pdf_file(uploaded_file)
175
  documents = [Document(text=t) for t in merged_chunks]
@@ -251,8 +254,7 @@ def process_pdf(uploaded_files, llm_model, n_criteria = num_criteria):
251
  # Generate the score bar HTML
252
  score_bar_html = generate_score_bar(total_score, n_criteria)
253
  scaled_total_score = str(round((total_score / n_criteria) * 100)) + "/100"
254
- output_path = f"/tmp/paper_report_{i+1}.pdf"
255
- create_pdf_report(title, author_result, scaled_total_score, reasoning_text, output_path)
256
  output_files.append(output_path)
257
 
258
  # Construct the processing message
 
170
  output_files = []
171
  for i, uploaded_file in enumerate(uploaded_files):
172
  # Process the PDF file
173
+ file_name_without_extension = os.path.splitext(os.path.basename(uploaded_file))[0]
174
+ file_name_without_extension
175
+
176
  pdf_processor = PDFProcessor_Unstructured(pdf_processing_config)
177
  merged_chunks, tables, title = pdf_processor.process_pdf_file(uploaded_file)
178
  documents = [Document(text=t) for t in merged_chunks]
 
254
  # Generate the score bar HTML
255
  score_bar_html = generate_score_bar(total_score, n_criteria)
256
  scaled_total_score = str(round((total_score / n_criteria) * 100)) + "/100"
257
+ create_pdf_report(title, author_result, scaled_total_score, reasoning_text, file_name_without_extension)
 
258
  output_files.append(output_path)
259
 
260
  # Construct the processing message