Manasa1 commited on
Commit
49a5185
·
verified ·
1 Parent(s): 292c858

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -35,31 +35,24 @@ def app_interface():
35
  with gr.Blocks() as app:
36
  gr.Markdown("# ESG Data Explorer")
37
  with gr.Tab("ESG Data"):
38
- # Dropdown to select company name
39
- company = gr.Dropdown(
40
- label="Select Company",
41
- choices=list(company_dict.keys()),
42
- value="Apple", # Default value
43
- interactive=True # Make it interactive
44
- )
45
- # Button to fetch and plot ESG data
46
  plot_button = gr.Button("Generate ESG Plot")
47
- # Dataframe for ESG scores
48
  line_plot = gr.LinePlot(label="ESG Scores Line Plot", x="ESG Category", y="Score", overlay_point=True)
49
  scatter_plot = gr.ScatterPlot(label="ESG Scores Scatter Plot", x="ESG Category", y="Score", overlay_point=True)
50
- # File output for CSV download
51
  csv_output = gr.File(label="Download CSV")
52
- # Define the action when the "Generate ESG Plot" button is clicked
53
  plot_button.click(fn=fetch_esg_data, inputs=company, outputs=[line_plot, csv_output, scatter_plot])
54
  with gr.Tab("Tab 2"):
55
  gr.Markdown("Content for Tab 2 goes here.")
56
- # Add more components relevant to Tab 2
57
  with gr.Tab("Tab 3"):
58
  gr.Markdown("Content for Tab 3 goes here.")
59
- # Add more components relevant to Tab 3
60
  with gr.Tab("Tab 4"):
61
  gr.Markdown("Content for Tab 4 goes here.")
62
- # Add more components relevant to Tab 4
63
  return app
64
 
65
  # Launch the Gradio app
 
35
  with gr.Blocks() as app:
36
  gr.Markdown("# ESG Data Explorer")
37
  with gr.Tab("ESG Data"):
38
+ with gr.Row():
39
+ company = gr.Dropdown(
40
+ label="Select Company",
41
+ choices=list(company_dict.keys()),
42
+ value="Apple", # Default value
43
+ interactive=True # Make it interactive
44
+ )
 
45
  plot_button = gr.Button("Generate ESG Plot")
 
46
  line_plot = gr.LinePlot(label="ESG Scores Line Plot", x="ESG Category", y="Score", overlay_point=True)
47
  scatter_plot = gr.ScatterPlot(label="ESG Scores Scatter Plot", x="ESG Category", y="Score", overlay_point=True)
 
48
  csv_output = gr.File(label="Download CSV")
 
49
  plot_button.click(fn=fetch_esg_data, inputs=company, outputs=[line_plot, csv_output, scatter_plot])
50
  with gr.Tab("Tab 2"):
51
  gr.Markdown("Content for Tab 2 goes here.")
 
52
  with gr.Tab("Tab 3"):
53
  gr.Markdown("Content for Tab 3 goes here.")
 
54
  with gr.Tab("Tab 4"):
55
  gr.Markdown("Content for Tab 4 goes here.")
 
56
  return app
57
 
58
  # Launch the Gradio app