Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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("
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
|
55 |
# LinePlot component for displaying the ESG data
|
56 |
-
|
57 |
|
58 |
-
|
|
|
59 |
|
60 |
-
|
61 |
-
|
62 |
|
63 |
-
|
64 |
-
|
65 |
|
66 |
# Define the action when the "Generate ESG Plot" button is clicked
|
67 |
-
|
68 |
inputs=company,
|
69 |
-
outputs=[
|
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 |
|
|
|
|