Download app.py from AeaaiLabs/VC_Syndicate_Intelligence_Portal: direct link, hf CLI and curl.
- Browser
- Download file 4.08 kB
-
https://huggingface.co/spaces/AeaaiLabs/VC_Syndicate_Intelligence_Portal/resolve/main/app.py
- Command line
-
hf download hf://spaces/AeaaiLabs/VC_Syndicate_Intelligence_Portal/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AeaaiLabs/VC_Syndicate_Intelligence_Portal/resolve/main/app.py
4.08 kB
| import streamlit as st | |
| import pandas as pd | |
| import plotly.express as px | |
| import plotly.graph_objects as go | |
| import os | |
| # --- 1. CONFIGURATION --- | |
| st.set_page_config(page_title="VC Intelligence Dashboard", layout="wide") | |
| # --- 2. DATA LOADING --- | |
| def load_data(): | |
| if not os.path.exists('output.csv'): | |
| st.error("'output.csv' not found. Please run your processing script first.") | |
| st.stop() | |
| return pd.read_csv('output.csv') | |
| def get_priority_theme(themes): | |
| if themes.empty: return "N/A" | |
| counts = themes.value_counts(normalize=True) | |
| if 'AI & Generative AI' in counts and counts['AI & Generative AI'] >= 0.10: | |
| return 'AI & Generative AI' | |
| if 'Industrial Automation' in counts and counts['Industrial Automation'] >= 0.10: | |
| return 'Industrial Automation' | |
| return counts.idxmax() | |
| def calculate_metrics(df_filtered): | |
| if df_filtered.empty: return pd.DataFrame() | |
| df_filtered = df_filtered.copy() | |
| df_filtered['Syndicate_Size'] = df_filtered.groupby('CIQ Transaction ID')['Standardized_Name'].transform('count') | |
| df_filtered['Weight_Contribution'] = df_filtered['Syndicate_Size'] - 1 | |
| investor_stats = df_filtered.groupby('Standardized_Name').agg( | |
| Total_Deals=('CIQ Transaction ID', 'nunique'), | |
| Weighted_Degree=('Weight_Contribution', 'sum'), | |
| Primary_Theme=('Theme', get_priority_theme), | |
| Super_Theme=('Super_Theme', lambda x: x.mode()[0] if not x.mode().empty else "Other") | |
| ).reset_index() | |
| N = investor_stats['Standardized_Name'].nunique() | |
| investor_stats['Centrality_%'] = (investor_stats['Weighted_Degree'] / (N - 1) * 100) if N > 1 else 0 | |
| investor_stats['Efficiency'] = investor_stats['Weighted_Degree'] / investor_stats['Total_Deals'] | |
| return investor_stats.sort_values('Weighted_Degree', ascending=False) | |
| # --- 3. UI & FILTERS --- | |
| df_master = load_data() | |
| st.sidebar.title("Research Controls") | |
| countries = sorted(df_master['Country'].unique().tolist()) | |
| selected_countries = st.sidebar.multiselect("Geography", countries, default=['United Kingdom', 'Germany', 'France']) | |
| super_themes = sorted(df_master['Super_Theme'].unique().tolist()) | |
| selected_super_themes = st.sidebar.multiselect("Super Theme", super_themes, default=super_themes) | |
| available_themes = sorted(df_master[df_master['Super_Theme'].isin(selected_super_themes)]['Theme'].unique().tolist()) | |
| selected_themes = st.sidebar.multiselect("Detailed Theme", available_themes, default=available_themes) | |
| mask = (df_master['Country'].isin(selected_countries)) & \ | |
| (df_master['Super_Theme'].isin(selected_super_themes)) & \ | |
| (df_master['Theme'].isin(selected_themes)) | |
| df_filtered = df_master[mask] | |
| report = calculate_metrics(df_filtered) | |
| st.title("VC Syndicate Intelligence Portal") | |
| if report.empty: | |
| st.warning("No data found for the current selection.") | |
| else: | |
| kpi1, kpi2, kpi3, kpi4 = st.columns(4) | |
| kpi1.metric("Unique Investors", f"{len(report):,}") | |
| kpi2.metric("Total Deals", f"{df_filtered['CIQ Transaction ID'].nunique():,}") | |
| # CHARTS - Updated with width='stretch' | |
| col_left, col_right = st.columns([3, 2]) | |
| with col_left: | |
| st.subheader("Investor Market Power") | |
| fig_power = px.bar(report.head(15), x='Weighted_Degree', y='Standardized_Name', orientation='h', color='Weighted_Degree', color_continuous_scale='Blues') | |
| st.plotly_chart(fig_power, width='stretch') # FIX APPLIED HERE | |
| with col_right: | |
| st.subheader("Sector Composition") | |
| fig_donut = px.pie(df_filtered, names='Super_Theme', hole=0.4) | |
| st.plotly_chart(fig_donut, width='stretch') # FIX APPLIED HERE | |
| st.subheader("Strategic Positioning") | |
| fig_scatter = px.scatter(report, x='Total_Deals', y='Centrality_%', size='Efficiency', color='Primary_Theme', hover_name='Standardized_Name') | |
| st.plotly_chart(fig_scatter, width='stretch') # FIX APPLIED HERE | |
| st.subheader("Detailed Feed") | |
| # Table updated with width='stretch' | |
| st.dataframe(report.drop(columns=['Super_Theme']), width='stretch') # FIX APPLIED HERE |