EngrNarmeen commited on
Commit
3b4fe45
·
verified ·
1 Parent(s): a490905

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -67,7 +67,9 @@ def generate_eia_report(file):
67
  pdf.cell(0, 10, "EXECUTIVE SUMMARY", ln=True)
68
  pdf.set_font("Arial", size=12)
69
  summary = df.get("Executive Summary", "No data provided.")
70
- pdf.multi_cell(0, 10, summary)
 
 
71
 
72
  # Example: Add more sections from the Excel data
73
  sections = ["Project Title", "Project Proponent", "Environmental Conditions"]
@@ -77,7 +79,9 @@ def generate_eia_report(file):
77
  pdf.cell(0, 10, section, ln=True)
78
  pdf.set_font("Arial", size=12)
79
  content = df.get(section, "No data provided.")
80
- pdf.multi_cell(0, 10, content)
 
 
81
 
82
  # Save the PDF to a local path that Gradio can access
83
  output_file = "EIA_Report.pdf" # Save in the current working directory
@@ -111,3 +115,4 @@ with gr.Blocks() as demo:
111
  submit_button.click(process_file, inputs=[file_input], outputs=[status_output, file_output])
112
 
113
  demo.launch()
 
 
67
  pdf.cell(0, 10, "EXECUTIVE SUMMARY", ln=True)
68
  pdf.set_font("Arial", size=12)
69
  summary = df.get("Executive Summary", "No data provided.")
70
+ if isinstance(summary, pd.Series):
71
+ summary = summary.iloc[0] # Take the first entry if it's a series
72
+ pdf.multi_cell(0, 10, str(summary))
73
 
74
  # Example: Add more sections from the Excel data
75
  sections = ["Project Title", "Project Proponent", "Environmental Conditions"]
 
79
  pdf.cell(0, 10, section, ln=True)
80
  pdf.set_font("Arial", size=12)
81
  content = df.get(section, "No data provided.")
82
+ if isinstance(content, pd.Series):
83
+ content = content.iloc[0] # Take the first entry if it's a series
84
+ pdf.multi_cell(0, 10, str(content))
85
 
86
  # Save the PDF to a local path that Gradio can access
87
  output_file = "EIA_Report.pdf" # Save in the current working directory
 
115
  submit_button.click(process_file, inputs=[file_input], outputs=[status_output, file_output])
116
 
117
  demo.launch()
118
+