rnmee commited on
Commit
3f7d0dc
·
verified ·
1 Parent(s): aa1a051

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -237,11 +237,9 @@ def generate_pdf_report(original_img: Image.Image, mask: np.ndarray, overlay: Im
237
  pdf.set_font("helvetica", "I", 10)
238
  pdf.cell(text="This report was generated by DR Analysis System", new_x="LMARGIN", new_y="NEXT", align='C')
239
 
240
- # Get PDF as bytes - the critical fix
241
- pdf_output = pdf.output()
242
- if isinstance(pdf_output, str):
243
- return pdf_output.encode('latin1')
244
- return pdf_output
245
 
246
  except Exception as e:
247
  st.error(f"PDF generation failed: {str(e)}")
 
237
  pdf.set_font("helvetica", "I", 10)
238
  pdf.cell(text="This report was generated by DR Analysis System", new_x="LMARGIN", new_y="NEXT", align='C')
239
 
240
+ # Get PDF as bytes
241
+ pdf_bytes = pdf.output(dest='S').encode('latin1')
242
+ return pdf_bytes
 
 
243
 
244
  except Exception as e:
245
  st.error(f"PDF generation failed: {str(e)}")