sadickam commited on
Commit
61b0e3a
Β·
verified Β·
1 Parent(s): eb4d4a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -221,7 +221,7 @@ def plot_sdg(df, title, pred_column, icons_folder='assets/icons/'):
221
  ),
222
  margin=dict(l=20, r=30, t=100, b=20), # Increased right margin for icon
223
  height=600,
224
- width=800,
225
  showlegend=False,
226
  template="simple_white",
227
  xaxis=dict(
@@ -264,7 +264,7 @@ def plot_sdg(df, title, pred_column, icons_folder='assets/icons/'):
264
 
265
  def save_figure_as_jpeg(fig, filename):
266
  """Saves the Plotly figure as a high-resolution JPEG."""
267
- pio.write_image(fig, filename, format='jpeg', width=900, height=600, scale=6)
268
 
269
  # Generate reports (page and sentence levels)
270
  def generate_page_report(df_pages, report_file_name):
@@ -540,11 +540,11 @@ def launch_interface():
540
 
541
  # Nested Tabs for Primary and Secondary SDGs
542
  with gr.Tabs():
543
- with gr.TabItem("πŸ“Š Primary SDGs"):
544
  with gr.Row():
545
  primary_page_plot = gr.Plot(label="πŸ“Š Primary SDGs [Page-Level]", scale=2)
546
  gr.Markdown(
547
- "When the analysis is completed, the Primary SDGs bar graph on the left will show "+
548
  "the percentage of pages that strongly align with each SDG. The icon for the most frequent "+
549
  "SDG will be highlighted above the graph. Download the Page Predictions CVS for further details.",
550
  label = "Note", container=True
@@ -556,11 +556,11 @@ def launch_interface():
556
  page_docx = gr.File(label="πŸ“„ Download Page Report DOCX")
557
  page_jpeg1 = gr.File(label="πŸ–ΌοΈ Download Primary SDGs JPEG")
558
 
559
- with gr.TabItem("πŸ“ˆ Secondary SDGs"):
560
  with gr.Row():
561
  secondary_page_plot = gr.Plot(label="πŸ“ˆ Secondary SDGs [Page-Level]", scale=2)
562
  gr.Markdown(
563
- "When the analysis is completed, the Secondary SDGs bar graph on the left will show "+
564
  "SDGs that are not the primary focus of the pages analysed. These SDGs are second to the "+
565
  "Primary SDGs. Download the Sentence Predictions CVS for further details",
566
  label = "Note", container=True
@@ -588,11 +588,11 @@ def launch_interface():
588
 
589
  # Nested Tabs for Primary and Secondary SDGs
590
  with gr.Tabs():
591
- with gr.TabItem("πŸ“Š Primary SDGs"):
592
  with gr.Row():
593
  primary_sentence_plot = gr.Plot(label="πŸ“Š Primary SDGs [Sentence-Level]", scale=2)
594
  gr.Markdown(
595
- "When the analysis is completed, the Primary SDGs bar graph on the left will show "+
596
  "the percentage of sentences that strongly align with each SDG. The icon for the most frequent "+
597
  "SDG will be highlighted above the graph. Download the Sentence Predictions CVS for further details.",
598
  label = "Note", container=True
@@ -604,7 +604,7 @@ def launch_interface():
604
  sentence_docx = gr.File(label="πŸ“„ Download Sentence Report DOCX")
605
  sentence_jpeg1 = gr.File(label="πŸ–ΌοΈ Download Primary SDGs JPEG")
606
 
607
- with gr.TabItem("πŸ“ˆ Secondary SDGs"):
608
  with gr.Row():
609
  secondary_sentence_plot = gr.Plot(label="πŸ“ˆ Secondary SDGs [Sentence-Level]", scale=2)
610
  gr.Markdown(
 
221
  ),
222
  margin=dict(l=20, r=30, t=100, b=20), # Increased right margin for icon
223
  height=600,
224
+ #width=800,
225
  showlegend=False,
226
  template="simple_white",
227
  xaxis=dict(
 
264
 
265
  def save_figure_as_jpeg(fig, filename):
266
  """Saves the Plotly figure as a high-resolution JPEG."""
267
+ pio.write_image(fig, filename, format='jpeg', width=1200, height=600, scale=6)
268
 
269
  # Generate reports (page and sentence levels)
270
  def generate_page_report(df_pages, report_file_name):
 
540
 
541
  # Nested Tabs for Primary and Secondary SDGs
542
  with gr.Tabs():
543
+ with gr.TabItem("πŸ“Š Primary SDGs Graph"):
544
  with gr.Row():
545
  primary_page_plot = gr.Plot(label="πŸ“Š Primary SDGs [Page-Level]", scale=2)
546
  gr.Markdown(
547
+ "When the analysis is done, the Primary SDGs bar graph on the left will show "+
548
  "the percentage of pages that strongly align with each SDG. The icon for the most frequent "+
549
  "SDG will be highlighted above the graph. Download the Page Predictions CVS for further details.",
550
  label = "Note", container=True
 
556
  page_docx = gr.File(label="πŸ“„ Download Page Report DOCX")
557
  page_jpeg1 = gr.File(label="πŸ–ΌοΈ Download Primary SDGs JPEG")
558
 
559
+ with gr.TabItem("πŸ“ˆ Secondary SDGs Graph"):
560
  with gr.Row():
561
  secondary_page_plot = gr.Plot(label="πŸ“ˆ Secondary SDGs [Page-Level]", scale=2)
562
  gr.Markdown(
563
+ "When the analysis is done, the Secondary SDGs bar graph on the left will show "+
564
  "SDGs that are not the primary focus of the pages analysed. These SDGs are second to the "+
565
  "Primary SDGs. Download the Sentence Predictions CVS for further details",
566
  label = "Note", container=True
 
588
 
589
  # Nested Tabs for Primary and Secondary SDGs
590
  with gr.Tabs():
591
+ with gr.TabItem("πŸ“Š Primary SDGs Graph"):
592
  with gr.Row():
593
  primary_sentence_plot = gr.Plot(label="πŸ“Š Primary SDGs [Sentence-Level]", scale=2)
594
  gr.Markdown(
595
+ "When the analysis is done, the Primary SDGs bar graph on the left will show "+
596
  "the percentage of sentences that strongly align with each SDG. The icon for the most frequent "+
597
  "SDG will be highlighted above the graph. Download the Sentence Predictions CVS for further details.",
598
  label = "Note", container=True
 
604
  sentence_docx = gr.File(label="πŸ“„ Download Sentence Report DOCX")
605
  sentence_jpeg1 = gr.File(label="πŸ–ΌοΈ Download Primary SDGs JPEG")
606
 
607
+ with gr.TabItem("πŸ“ˆ Secondary SDGs Graph"):
608
  with gr.Row():
609
  secondary_sentence_plot = gr.Plot(label="πŸ“ˆ Secondary SDGs [Sentence-Level]", scale=2)
610
  gr.Markdown(