Manasa1 commited on
Commit
43a5e80
·
verified ·
1 Parent(s): 31d5a4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -45,28 +45,29 @@ def fetch_esg_data(company_name):
45
  # Gradio interface with a dropdown for company selection, line plot visualization, and CSV download
46
  def app_interface():
47
  with gr.Blocks() as app:
48
- with gr.Tab("plot"):
49
- #Dropdown to select company name
50
- company = gr.Dropdown(label="Select Company", choices=list(company_dict.keys()), value="Apple")
51
 
52
- #Button to fetch and plot ESG data
53
- plot_button = gr.Button("Generate ESG Plot")
54
 
55
  # LinePlot component for displaying the ESG data
56
- line_plot = gr.LinePlot(label="ESG Scores Plot", x="ESG Category", y="Score", overlay_point=True)
57
 
58
- scatter_plot = gr.ScatterPlot(label="ESG Scores Scatter Plot", x="ESG Category", y="Score", overlay_point=True)
 
59
 
60
- # Textbox to display messages
61
- message = gr.Textbox(label="Message", interactive=False)
62
 
63
- # File output for CSV download
64
- csv_output = gr.File(label="Download CSV")
65
 
66
  # Define the action when the "Generate ESG Plot" button is clicked
67
- plot_button.click(fn=fetch_esg_data,
68
  inputs=company,
69
- outputs=[csv_output, line_plot, scatter_plot])
70
 
71
  return app
72
 
@@ -74,5 +75,3 @@ def app_interface():
74
  app = app_interface()
75
  app.launch()
76
 
77
-
78
-
 
45
  # Gradio interface with a dropdown for company selection, line plot visualization, and CSV download
46
  def app_interface():
47
  with gr.Blocks() as app:
48
+ with gr.Tab("Plot"):
49
+ # Dropdown to select company name
50
+ company = gr.Dropdown(label="Select Company", choices=list(company_dict.keys()), value="Apple")
51
 
52
+ # Button to fetch and plot ESG data
53
+ plot_button = gr.Button("Generate ESG Plot")
54
 
55
  # LinePlot component for displaying the ESG data
56
+ line_plot = gr.LinePlot(label="ESG Scores Line Plot", x="ESG Category", y="Score", overlay_point=True)
57
 
58
+ # ScatterPlot component for displaying the ESG data
59
+ scatter_plot = gr.ScatterPlot(label="ESG Scores Scatter Plot", x="ESG Category", y="Score", overlay_point=True)
60
 
61
+ # Textbox to display messages
62
+ message = gr.Textbox(label="Message", interactive=False)
63
 
64
+ # File output for CSV download
65
+ csv_output = gr.File(label="Download CSV")
66
 
67
  # Define the action when the "Generate ESG Plot" button is clicked
68
+ plot_button.click(fn=fetch_esg_data,
69
  inputs=company,
70
+ outputs=[line_plot, csv_output, scatter_plot])
71
 
72
  return app
73
 
 
75
  app = app_interface()
76
  app.launch()
77