rheremans commited on
Commit
d307dd7
Β·
1 Parent(s): ef7a7cd

Defer Streamlit setup to runtime; lazy-import main in app.py

Browse files
Files changed (2) hide show
  1. app.py +2 -3
  2. human_design_app.py +12 -10
app.py CHANGED
@@ -9,8 +9,7 @@ import os
9
  # Add the current directory to Python path
10
  sys.path.append(os.path.dirname(os.path.abspath(__file__)))
11
 
12
- # Import and run the main application
13
- from human_design_app import main
14
-
15
  if __name__ == "__main__":
 
 
16
  main()
 
9
  # Add the current directory to Python path
10
  sys.path.append(os.path.dirname(os.path.abspath(__file__)))
11
 
 
 
 
12
  if __name__ == "__main__":
13
+ # Import lazily to avoid import-time Streamlit initialization issues
14
+ from human_design_app import main
15
  main()
human_design_app.py CHANGED
@@ -13,16 +13,18 @@ import base64
13
  from typing import Dict, List, Tuple, Optional
14
  import math
15
 
16
- # Set page config
17
- st.set_page_config(
18
- page_title="Human Design Chart Generator",
19
- page_icon="🌟",
20
- layout="wide",
21
- initial_sidebar_state="expanded"
22
- )
 
 
23
 
24
- # Custom CSS for better styling
25
- st.markdown("""
26
  <style>
27
  .main-header {
28
  font-size: 3rem;
@@ -342,7 +344,7 @@ def create_pdf_report(name: str, email: str, birth_date: date, birth_time: str,
342
 
343
  def main():
344
  """Main Streamlit application"""
345
-
346
  st.markdown('<h1 class="main-header">🌟 Human Design Chart Generator</h1>', unsafe_allow_html=True)
347
 
348
  st.markdown("""
 
13
  from typing import Dict, List, Tuple, Optional
14
  import math
15
 
16
+ def _setup_page():
17
+ """Configure Streamlit page and inject styles. Call inside main()."""
18
+ # Set page config
19
+ st.set_page_config(
20
+ page_title="Human Design Chart Generator",
21
+ page_icon="🌟",
22
+ layout="wide",
23
+ initial_sidebar_state="expanded"
24
+ )
25
 
26
+ # Custom CSS for better styling
27
+ st.markdown("""
28
  <style>
29
  .main-header {
30
  font-size: 3rem;
 
344
 
345
  def main():
346
  """Main Streamlit application"""
347
+ _setup_page()
348
  st.markdown('<h1 class="main-header">🌟 Human Design Chart Generator</h1>', unsafe_allow_html=True)
349
 
350
  st.markdown("""