kpal002 commited on
Commit
2eafe83
·
verified ·
1 Parent(s): 7ac967f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -5
app.py CHANGED
@@ -116,14 +116,29 @@ class PDF(FPDF):
116
  def create_pdf_report(title, author_info, score, reasoning_text, output_path):
117
  pdf = PDF()
118
  pdf.add_page()
119
- # Set the font to DejaVu for Unicode support
120
- pdf.set_font("DejaVu", size=12)
 
 
 
 
 
121
  pdf.cell(0, 10, f"Title: {title}", 0, 1)
 
 
 
122
  pdf.cell(0, 10, f"Author Information: {author_info}", 0, 1)
 
 
 
123
  pdf.cell(0, 10, f"Score: {score}", 0, 1)
 
 
 
124
  pdf.multi_cell(0, 10, f"Reasoning:\n{reasoning_text}")
125
- pdf.output(output_path)
126
 
 
 
127
 
128
  def process_pdf(uploaded_files, llm_model, n_criteria = num_criteria):
129
  # Initialize aggregation variables
@@ -215,9 +230,9 @@ def process_pdf(uploaded_files, llm_model, n_criteria = num_criteria):
215
 
216
  # Generate the score bar HTML
217
  score_bar_html = generate_score_bar(total_score, n_criteria)
218
-
219
  output_path = f"/tmp/paper_report_{i+1}.pdf"
220
- create_pdf_report(title, author_result, total_score, reasoning_text, output_path)
221
  output_files.append(output_path)
222
 
223
  # Construct the processing message
 
116
  def create_pdf_report(title, author_info, score, reasoning_text, output_path):
117
  pdf = PDF()
118
  pdf.add_page()
119
+
120
+ # Set margins if needed, you can adjust the values accordingly
121
+ pdf.set_left_margin(10)
122
+ pdf.set_right_margin(10)
123
+
124
+ # Title in bold and larger font size
125
+ pdf.set_font("DejaVu", 'B', 14) # Use bold style and increase font size
126
  pdf.cell(0, 10, f"Title: {title}", 0, 1)
127
+
128
+ # Author Information in bold and larger font size
129
+ pdf.set_font("DejaVu", 'B', 14) # Keep bold style and font size for consistency
130
  pdf.cell(0, 10, f"Author Information: {author_info}", 0, 1)
131
+
132
+ # Score in bold and larger font size
133
+ pdf.set_font("DejaVu", 'B', 14) # Keep bold style and font size for consistency
134
  pdf.cell(0, 10, f"Score: {score}", 0, 1)
135
+
136
+ # Reasoning in bold and larger font size
137
+ pdf.set_font("DejaVu", 'B', 14) # Keep bold style and font size for consistency
138
  pdf.multi_cell(0, 10, f"Reasoning:\n{reasoning_text}")
 
139
 
140
+ # Save the PDF to the specified output path
141
+ pdf.output(output_path)
142
 
143
  def process_pdf(uploaded_files, llm_model, n_criteria = num_criteria):
144
  # Initialize aggregation variables
 
230
 
231
  # Generate the score bar HTML
232
  score_bar_html = generate_score_bar(total_score, n_criteria)
233
+ scaled_total_score = str(round((total_score / n_criteria) * 100)) + "/100"
234
  output_path = f"/tmp/paper_report_{i+1}.pdf"
235
+ create_pdf_report(title, author_result, scaled_total_score, reasoning_text, output_path)
236
  output_files.append(output_path)
237
 
238
  # Construct the processing message