Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -200,17 +200,6 @@ def generate_graph(selected_investors, filtered_data):
|
|
200 |
|
201 |
return fig
|
202 |
|
203 |
-
# Gradio app function to update CheckboxGroup and filtered data
|
204 |
-
def app(selected_country, selected_industry):
|
205 |
-
investor_list, filtered_data = filter_investors_by_country_and_industry(selected_country, selected_industry)
|
206 |
-
logger.info("Updating CheckboxGroup and filtered data holder.")
|
207 |
-
|
208 |
-
return gr.update(
|
209 |
-
choices=investor_list,
|
210 |
-
value=investor_list,
|
211 |
-
visible=True
|
212 |
-
), filtered_data
|
213 |
-
|
214 |
# Gradio Interface
|
215 |
def main():
|
216 |
country_list = ["All"] + sorted(data["Country"].dropna().unique())
|
@@ -234,36 +223,15 @@ def main():
|
|
234 |
filtered_data_holder = gr.State()
|
235 |
|
236 |
country_filter.change(
|
237 |
-
|
238 |
-
inputs=[country_filter, industry_filter],
|
239 |
-
outputs=[filtered_investor_list, filtered_data_holder]
|
240 |
-
)
|
241 |
-
industry_filter.change(
|
242 |
-
app,
|
243 |
inputs=[country_filter, industry_filter],
|
244 |
outputs=[filtered_investor_list, filtered_data_holder]
|
245 |
)
|
246 |
-
|
247 |
filtered_investor_list.change(
|
248 |
generate_graph,
|
249 |
inputs=[filtered_investor_list, filtered_data_holder],
|
250 |
outputs=graph_output
|
251 |
)
|
252 |
-
|
253 |
-
def display_valuation(click_data):
|
254 |
-
if not click_data:
|
255 |
-
return "Click on a company node to see its valuation."
|
256 |
-
# click_data is a list of dictionaries
|
257 |
-
point = click_data[0] # Get the first point clicked
|
258 |
-
if "customdata" in point and point["customdata"]:
|
259 |
-
return f"**Valuation:** {point['customdata']}"
|
260 |
-
return "Click on a company node to see its valuation."
|
261 |
-
|
262 |
-
graph_output.plotly_events(
|
263 |
-
fn=display_valuation,
|
264 |
-
inputs=None,
|
265 |
-
outputs=valuation_display
|
266 |
-
)
|
267 |
|
268 |
demo.launch()
|
269 |
|
|
|
200 |
|
201 |
return fig
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
# Gradio Interface
|
204 |
def main():
|
205 |
country_list = ["All"] + sorted(data["Country"].dropna().unique())
|
|
|
223 |
filtered_data_holder = gr.State()
|
224 |
|
225 |
country_filter.change(
|
226 |
+
filter_investors_by_country_and_industry,
|
|
|
|
|
|
|
|
|
|
|
227 |
inputs=[country_filter, industry_filter],
|
228 |
outputs=[filtered_investor_list, filtered_data_holder]
|
229 |
)
|
|
|
230 |
filtered_investor_list.change(
|
231 |
generate_graph,
|
232 |
inputs=[filtered_investor_list, filtered_data_holder],
|
233 |
outputs=graph_output
|
234 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
demo.launch()
|
237 |
|