mgbam commited on
Commit
7c66e2d
Β·
verified Β·
1 Parent(s): ab11f85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -13
app.py CHANGED
@@ -1,43 +1,52 @@
1
  import streamlit as st
2
- import os
3
  from landing import show_landing
4
  from agent_manager import AgentManager
5
  from dashboard.logs import show_logs
6
  from stripe_checkout import create_stripe_session
7
 
8
- # Initialize session state for page navigation
9
  if "page" not in st.session_state:
10
  st.session_state.page = "Home"
11
 
12
- # Sidebar navigation
 
 
 
 
13
  st.sidebar.title("AutoExec AI")
14
- st.session_state.page = st.sidebar.radio(
15
  "Go to",
16
- ["Home", "Launch", "Logs", "Settings"],
17
- index=["Home", "Launch", "Logs", "Settings"].index(st.session_state.page),
18
  key="page",
19
  )
20
 
21
- # Route to the correct page
22
- if st.session_state.page == "Home":
 
 
 
23
  show_landing()
24
 
25
- elif st.session_state.page == "Launch":
26
  st.header("πŸš€ Launch a New AI Business")
27
  niche = st.text_input("Niche (e.g., fitness)")
28
- business_type = st.selectbox("Business Type", ["Dropshipping", "Print-on-Demand", "Newsletter", "Course"])
 
 
 
29
  if st.button("Generate & Deploy"):
30
  manager = AgentManager(niche, business_type)
31
  result = manager.run_all()
32
  st.success("βœ… Business Launched!")
33
  st.json(result)
34
 
35
- elif st.session_state.page == "Logs":
36
  show_logs()
37
 
38
- elif st.session_state.page == "Settings":
39
  st.header("βš™οΈ Settings & Billing")
40
  if st.button("Create Stripe Checkout Session"):
41
  url = create_stripe_session()
42
  st.markdown(f"[Pay & Activate]({url})")
43
- st.markdown("Manage API keys and subscriptions here.")
 
1
  import streamlit as st
 
2
  from landing import show_landing
3
  from agent_manager import AgentManager
4
  from dashboard.logs import show_logs
5
  from stripe_checkout import create_stripe_session
6
 
7
+ # Initialize default page if not already set
8
  if "page" not in st.session_state:
9
  st.session_state.page = "Home"
10
 
11
+ # Define the list of pages
12
+ PAGES = ["Home", "Launch", "Logs", "Settings"]
13
+
14
+ # Create a radio widget in the sidebar, keyed to 'page'
15
+ # This widget *updates* st.session_state.page automatically
16
  st.sidebar.title("AutoExec AI")
17
+ st.sidebar.radio(
18
  "Go to",
19
+ PAGES,
20
+ index=PAGES.index(st.session_state.page),
21
  key="page",
22
  )
23
 
24
+ # Read the current page (streamlit will have set session_state.page for us)
25
+ page = st.session_state.page
26
+
27
+ # Route to the correct content
28
+ if page == "Home":
29
  show_landing()
30
 
31
+ elif page == "Launch":
32
  st.header("πŸš€ Launch a New AI Business")
33
  niche = st.text_input("Niche (e.g., fitness)")
34
+ business_type = st.selectbox(
35
+ "Business Type",
36
+ ["Dropshipping", "Print-on-Demand", "Newsletter", "Course"]
37
+ )
38
  if st.button("Generate & Deploy"):
39
  manager = AgentManager(niche, business_type)
40
  result = manager.run_all()
41
  st.success("βœ… Business Launched!")
42
  st.json(result)
43
 
44
+ elif page == "Logs":
45
  show_logs()
46
 
47
+ elif page == "Settings":
48
  st.header("βš™οΈ Settings & Billing")
49
  if st.button("Create Stripe Checkout Session"):
50
  url = create_stripe_session()
51
  st.markdown(f"[Pay & Activate]({url})")
52
+ st.markdown("Manage your API keys and subscriptions here.")