Spaces:
Runtime error
Runtime error
File size: 1,245 Bytes
ce06eb4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/usr/bin/env python3
"""追加 main 函数到 app.py"""
append_content = '''
def main():
"""主函数"""
init_session_state()
# 侧边栏
with st.sidebar:
st.title("📊 数据指标建模助手")
st.markdown("**v3.0**")
st.divider()
# 进度显示
st.subheader("📍 当前进度")
steps = ["Step 1: 输入需求", "Step 2: 选择指标", "Step 3: 查看方案"]
for i, step in enumerate(steps, 1):
if i == st.session_state.current_step:
st.markdown(f"**→ {step}**")
elif i < st.session_state.current_step:
st.markdown(f"~~{step}~~ ✅")
else:
st.markdown(f"**{step}**")
st.divider()
st.caption("© 2026 数据指标建模助手")
# 主内容区域
if st.session_state.current_step == 1:
step1_input_requirement()
elif st.session_state.current_step == 2:
step2_select_indicators()
elif st.session_state.current_step == 3:
step3_view_scheme()
if __name__ == "__main__":
main()
'''
with open('app.py', 'a', encoding='utf-8') as f:
f.write(append_content)
print('✅ main 函数已追加')
|