Download app.py from Gileskk/APP: direct link, hf CLI and curl.
- Browser
- Download file 2.84 kB
-
https://huggingface.co/spaces/Gileskk/APP/resolve/main/app.py
- Command line
-
hf download hf://spaces/Gileskk/APP/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Gileskk/APP/resolve/main/app.py
2.84 kB
| import streamlit as st | |
| import pandas as pd | |
| import numpy as np | |
| # 设置页面配置 | |
| st.set_page_config( | |
| page_title="Dogs and Cats Home", | |
| page_icon="🐱🐕", | |
| layout="wide" | |
| ) | |
| # 添加自定义CSS样式 | |
| st.markdown(""" | |
| <style> | |
| .main { | |
| padding: 2rem; | |
| } | |
| .stButton>button { | |
| width: 100%; | |
| } | |
| .metric-card { | |
| background-color: #f0f2f6; | |
| padding: 1rem; | |
| border-radius: 0.5rem; | |
| margin: 1rem 0; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| # 侧边栏 | |
| with st.sidebar: | |
| st.title("导航菜单") | |
| page = st.radio( | |
| "选择功能模块", | |
| ["数据概览", "产权分析", "风险评估", "政策建议"] | |
| ) | |
| st.markdown("---") | |
| st.markdown("### 数据筛选") | |
| date_range = st.date_input("选择日期范围", []) | |
| data_type = st.multiselect( | |
| "数据类型", | |
| ["个人数据", "企业数据", "政府数据", "平台数据"] | |
| ) | |
| # 主页面内容 | |
| st.title("📊 数据产权配置分析平台") | |
| st.markdown("### 欢迎使用数据产权配置分析系统") | |
| # 创建三列布局 | |
| col1, col2, col3 = st.columns(3) | |
| # 第一列:关键指标 | |
| with col1: | |
| st.markdown("### 数据交易概览") | |
| st.metric(label="总交易量", value="1,234", delta="12%") | |
| st.metric(label="平均交易额", value="¥45,678", delta="-3%") | |
| # 第二列:图表展示 | |
| with col2: | |
| st.markdown("### 交易趋势") | |
| chart_data = pd.DataFrame( | |
| np.random.randn(20, 3), | |
| columns=['个人数据', '企业数据', '政府数据'] | |
| ) | |
| st.line_chart(chart_data) | |
| # 第三列:风险指标 | |
| with col3: | |
| st.markdown("### 风险监控") | |
| st.progress(75) | |
| st.markdown("系统风险指数: 75%") | |
| st.progress(45) | |
| st.markdown("合规风险指数: 45%") | |
| # 添加交互式表格 | |
| st.markdown("### 最新交易数据") | |
| data = pd.DataFrame({ | |
| '交易ID': range(1, 6), | |
| '数据类型': ['个人数据', '企业数据', '政府数据', '平台数据', '个人数据'], | |
| '交易金额': np.random.randint(1000, 10000, 5), | |
| '风险等级': ['低', '中', '高', '低', '中'] | |
| }) | |
| st.dataframe(data) | |
| # 添加交互式控件 | |
| st.markdown("### 数据筛选") | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| risk_level = st.select_slider( | |
| "风险等级", | |
| options=['低', '中', '高'] | |
| ) | |
| with col2: | |
| amount_range = st.slider( | |
| "交易金额范围", | |
| 0, 10000, (1000, 5000) | |
| ) | |
| # 添加下载按钮 | |
| st.download_button( | |
| label="下载分析报告", | |
| data="示例报告内容", | |
| file_name="数据产权分析报告.csv", | |
| mime="text/csv" | |
| ) | |
| # 页脚 | |
| st.markdown("---") | |
| st.markdown("© 2024 数据产权配置分析平台 | 版本 1.0") | |