Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -42,28 +42,38 @@ def fetch_esg_data(company_name):
|
|
42 |
# Return an empty DataFrame and None if no data is available
|
43 |
return pd.DataFrame(), None
|
44 |
|
45 |
-
# Gradio interface with
|
46 |
def app_interface():
|
47 |
with gr.Blocks() as app:
|
48 |
-
|
49 |
-
|
|
|
50 |
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
55 |
-
|
56 |
|
57 |
-
|
58 |
-
|
59 |
|
60 |
-
|
61 |
-
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
|
68 |
return app
|
69 |
|
|
|
42 |
# Return an empty DataFrame and None if no data is available
|
43 |
return pd.DataFrame(), None
|
44 |
|
45 |
+
# Gradio interface with multiple tabs
|
46 |
def app_interface():
|
47 |
with gr.Blocks() as app:
|
48 |
+
with gr.Tab("ESG Data Analysis"):
|
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 |
+
plot_output = gr.LinePlot(label="ESG Scores Plot", x="ESG Category", y="Score", overlay_point=True)
|
57 |
|
58 |
+
# Textbox to display messages
|
59 |
+
message = gr.Textbox(label="Message", interactive=False)
|
60 |
|
61 |
+
# File output for CSV download
|
62 |
+
csv_output = gr.File(label="Download CSV")
|
63 |
|
64 |
+
# Define the action when the "Generate ESG Plot" button is clicked
|
65 |
+
plot_button.click(fn=fetch_esg_data,
|
66 |
+
inputs=company,
|
67 |
+
outputs=[plot_output, csv_output])
|
68 |
+
|
69 |
+
with gr.Tab("Tab 2"):
|
70 |
+
gr.Markdown("This is Tab 2. You can add more content here.")
|
71 |
+
|
72 |
+
with gr.Tab("Tab 3"):
|
73 |
+
gr.Markdown("This is Tab 3. Add your custom functionality here.")
|
74 |
+
|
75 |
+
with gr.Tab("Tab 4"):
|
76 |
+
gr.Markdown("This is Tab 4. Add more features or visualization here.")
|
77 |
|
78 |
return app
|
79 |
|