Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -184,18 +184,11 @@ def generate_graph(investors, filtered_data):
|
|
184 |
)
|
185 |
)
|
186 |
|
187 |
-
legend_items = [
|
188 |
-
go.Scatter(
|
189 |
-
x=[None], y=[None], mode='markers',
|
190 |
-
marker=dict(size=10, color=investor_color_map[investor]),
|
191 |
-
legendgroup=investor, showlegend=True, name=investor
|
192 |
-
) for investor in unique_investors
|
193 |
-
]
|
194 |
-
|
195 |
# Compute total market cap
|
196 |
total_market_cap = filtered_data["Valuation_Billions"].sum()
|
197 |
|
198 |
-
fig = go.Figure(data=
|
|
|
199 |
fig.update_layout(
|
200 |
title="",
|
201 |
titlefont_size=24,
|
@@ -206,6 +199,7 @@ def generate_graph(investors, filtered_data):
|
|
206 |
autosize=True,
|
207 |
xaxis={'showgrid': False, 'zeroline': False, 'visible': False},
|
208 |
yaxis={'showgrid': False, 'zeroline': False, 'visible': False},
|
|
|
209 |
annotations=[
|
210 |
dict(
|
211 |
x=0.5, y=1.1, xref='paper', yref='paper',
|
@@ -223,9 +217,9 @@ def app(selected_country, selected_industry, selected_company, selected_investor
|
|
223 |
investors, filtered_data = filter_investors(selected_country, selected_industry, selected_investors, selected_company,
|
224 |
exclude_countries, exclude_industries, exclude_companies, exclude_investors)
|
225 |
if not investors:
|
226 |
-
return
|
227 |
graph = generate_graph(investors, filtered_data)
|
228 |
-
return
|
229 |
|
230 |
def main():
|
231 |
country_list = ["All"] + sorted(data["Country"].dropna().unique())
|
@@ -245,13 +239,11 @@ def main():
|
|
245 |
exclude_industry_filter = gr.Dropdown(choices=industry_list[1:], label="Exclude Industry", value=[], multiselect=True)
|
246 |
exclude_company_filter = gr.Dropdown(choices=company_list[1:], label="Exclude Company", value=[], multiselect=True)
|
247 |
exclude_investor_filter = gr.Dropdown(choices=investor_list, label="Exclude Investors", value=[], multiselect=True)
|
248 |
-
with gr.Row():
|
249 |
-
investor_output = gr.Textbox(label="Filtered Investors", interactive=False)
|
250 |
graph_output = gr.Plot(label="Network Graph")
|
251 |
|
252 |
inputs = [country_filter, industry_filter, company_filter, investor_filter,
|
253 |
exclude_country_filter, exclude_industry_filter, exclude_company_filter, exclude_investor_filter]
|
254 |
-
outputs = [
|
255 |
|
256 |
# Set up event triggers for all inputs
|
257 |
for input_control in inputs:
|
|
|
184 |
)
|
185 |
)
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
# Compute total market cap
|
188 |
total_market_cap = filtered_data["Valuation_Billions"].sum()
|
189 |
|
190 |
+
fig = go.Figure(data=[edge_trace, node_trace])
|
191 |
+
|
192 |
fig.update_layout(
|
193 |
title="",
|
194 |
titlefont_size=24,
|
|
|
199 |
autosize=True,
|
200 |
xaxis={'showgrid': False, 'zeroline': False, 'visible': False},
|
201 |
yaxis={'showgrid': False, 'zeroline': False, 'visible': False},
|
202 |
+
showlegend=False, # Hide the legend to maximize space
|
203 |
annotations=[
|
204 |
dict(
|
205 |
x=0.5, y=1.1, xref='paper', yref='paper',
|
|
|
217 |
investors, filtered_data = filter_investors(selected_country, selected_industry, selected_investors, selected_company,
|
218 |
exclude_countries, exclude_industries, exclude_companies, exclude_investors)
|
219 |
if not investors:
|
220 |
+
return go.Figure()
|
221 |
graph = generate_graph(investors, filtered_data)
|
222 |
+
return graph
|
223 |
|
224 |
def main():
|
225 |
country_list = ["All"] + sorted(data["Country"].dropna().unique())
|
|
|
239 |
exclude_industry_filter = gr.Dropdown(choices=industry_list[1:], label="Exclude Industry", value=[], multiselect=True)
|
240 |
exclude_company_filter = gr.Dropdown(choices=company_list[1:], label="Exclude Company", value=[], multiselect=True)
|
241 |
exclude_investor_filter = gr.Dropdown(choices=investor_list, label="Exclude Investors", value=[], multiselect=True)
|
|
|
|
|
242 |
graph_output = gr.Plot(label="Network Graph")
|
243 |
|
244 |
inputs = [country_filter, industry_filter, company_filter, investor_filter,
|
245 |
exclude_country_filter, exclude_industry_filter, exclude_company_filter, exclude_investor_filter]
|
246 |
+
outputs = [graph_output]
|
247 |
|
248 |
# Set up event triggers for all inputs
|
249 |
for input_control in inputs:
|