Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -124,6 +124,7 @@ def process_pdf(uploaded_files, llm_model, n_criteria = num_criteria):
|
|
124 |
final_score_bar_html = ""
|
125 |
final_author_info_html = ""
|
126 |
final_title_info_html = ""
|
|
|
127 |
for i, uploaded_file in enumerate(uploaded_files):
|
128 |
# Process the PDF file
|
129 |
pdf_processor = PDFProcessor_Unstructured(pdf_processing_config)
|
@@ -214,23 +215,15 @@ def process_pdf(uploaded_files, llm_model, n_criteria = num_criteria):
|
|
214 |
output_path = f"/tmp/paper_report_{i+1}.pdf"
|
215 |
create_pdf_report(title_info_html, author_info_html, score, reasoning_html, output_path)
|
216 |
output_files.append(output_path)
|
|
|
|
|
|
|
217 |
|
218 |
-
|
219 |
# Return the score as a string and the reasoning as HTML
|
220 |
#return str(round((total_score / n_criteria) * 100)) + "/100", score_bar_html, reasoning_html, author_info_html, title_info_html
|
221 |
|
222 |
|
223 |
-
def process_and_generate_reports(uploaded_files, llm_model):
|
224 |
-
# Process files and generate reports as before
|
225 |
-
# For demonstration, let's assume we generate dummy report paths
|
226 |
-
generated_reports = []
|
227 |
-
for i, _ in enumerate(uploaded_files):
|
228 |
-
report_path = f"dummy_report_{i + 1}.pdf" # Replace with actual report generation logic
|
229 |
-
generated_reports.append(report_path)
|
230 |
-
# Simulate processing with a message to indicate reports are ready
|
231 |
-
processing_message = f"Processing complete. {len(uploaded_files)} reports generated. Please download your reports below."
|
232 |
-
return processing_message, generated_reports
|
233 |
-
|
234 |
with gr.Blocks(theme=gr.themes.Glass(
|
235 |
text_size="sm",
|
236 |
font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"],
|
|
|
124 |
final_score_bar_html = ""
|
125 |
final_author_info_html = ""
|
126 |
final_title_info_html = ""
|
127 |
+
output_files = []
|
128 |
for i, uploaded_file in enumerate(uploaded_files):
|
129 |
# Process the PDF file
|
130 |
pdf_processor = PDFProcessor_Unstructured(pdf_processing_config)
|
|
|
215 |
output_path = f"/tmp/paper_report_{i+1}.pdf"
|
216 |
create_pdf_report(title_info_html, author_info_html, score, reasoning_html, output_path)
|
217 |
output_files.append(output_path)
|
218 |
+
|
219 |
+
# Construct the processing message
|
220 |
+
processing_message = f"Processing complete. {len(uploaded_files)} reports generated. Please download your reports below."
|
221 |
|
222 |
+
return processing_message, output_files
|
223 |
# Return the score as a string and the reasoning as HTML
|
224 |
#return str(round((total_score / n_criteria) * 100)) + "/100", score_bar_html, reasoning_html, author_info_html, title_info_html
|
225 |
|
226 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
with gr.Blocks(theme=gr.themes.Glass(
|
228 |
text_size="sm",
|
229 |
font=[gr.themes.GoogleFont("Inconsolata"), "Arial", "sans-serif"],
|