mgbam commited on
Commit
85ebef7
Β·
verified Β·
1 Parent(s): 5bd7142

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +77 -28
app.py CHANGED
@@ -4,49 +4,98 @@ 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.")
 
 
 
 
 
 
 
 
 
4
  from dashboard.logs import show_logs
5
  from stripe_checkout import create_stripe_session
6
 
7
+ # ─── Page Configuration ───────────────────────────────────────────────────────
8
+ st.set_page_config(
9
+ page_title="AutoExec AI",
10
+ page_icon="πŸš€",
11
+ layout="wide",
12
+ initial_sidebar_state="expanded",
13
+ )
14
+
15
+ # ─── Sidebar Navigation ───────────────────────────────────────────────────────
16
  if "page" not in st.session_state:
17
  st.session_state.page = "Home"
18
 
19
+ PAGES = {
20
+ "Home": "🏠 Home",
21
+ "Launch": "πŸš€ Launch",
22
+ "Logs": "πŸ“Š Logs",
23
+ "Settings": "βš™οΈ Settings"
24
+ }
25
 
 
 
26
  st.sidebar.title("AutoExec AI")
27
+ selection = st.sidebar.radio(
28
+ "Navigate to",
29
+ list(PAGES.values()),
30
+ index=list(PAGES.values()).index(PAGES[st.session_state.page]),
31
+ key="page_choice"
32
  )
33
 
34
+ # Map back to internal page names
35
+ page = next(k for k, v in PAGES.items() if v == selection)
36
+ st.session_state.page = page
37
 
38
+ # ─── Main Content ─────────────────────────────────────────────────────────────
39
  if page == "Home":
40
+ # Full-bleed hero section
41
+ st.markdown(
42
+ """
43
+ <div style="text-align:center; margin: 2rem 0;">
44
+ <h1 style="font-size:3rem;">πŸš€ AutoExec AI</h1>
45
+ <p style="font-size:1.25rem; color: #666;">
46
+ Your Autonomous AI Business Builder<br>
47
+ Launch, manage, and optimize digital businesses in one click.
48
+ </p>
49
+ </div>
50
+ """,
51
+ unsafe_allow_html=True,
52
+ )
53
  show_landing()
54
 
55
  elif page == "Launch":
56
+ st.subheader("πŸš€ Launch a New AI Business")
57
+ with st.form("launch_form", clear_on_submit=False):
58
+ niche = st.text_input("🎯 Niche", placeholder="e.g., fitness")
59
+ business_type = st.selectbox(
60
+ "πŸ“¦ Business Type",
61
+ ["Dropshipping", "Print-on-Demand", "Newsletter", "Course"],
62
+ )
63
+ launched = st.form_submit_button("Generate & Deploy")
64
+ if launched:
65
+ if not niche.strip():
66
+ st.error("Please enter a valid niche.")
67
+ else:
68
+ with st.spinner("πŸ€– Running agents... this takes a few seconds"):
69
+ manager = AgentManager(niche.strip(), business_type)
70
+ result = manager.run_all()
71
+ st.success("βœ… Business Launched!")
72
+ st.json(result)
73
 
74
  elif page == "Logs":
75
+ st.subheader("πŸ“Š Agent Memory Log Dashboard")
76
  show_logs()
77
 
78
  elif page == "Settings":
79
+ st.subheader("βš™οΈ Settings & Billing")
80
+ st.markdown(
81
+ """
82
+ Manage your API keys, subscriptions, and integrations.
83
+ Ensure you’ve set the following in **Settings β†’ Secrets**:
84
+ - `API_KEY`
85
+ - `OPENAI_API_KEY`
86
+ - `GEMINI_API_KEY`
87
+ - `STRIPE_API_KEY`
88
+ """
89
+ )
90
+ if st.button("πŸ’³ Create Stripe Checkout Session"):
91
  url = create_stripe_session()
92
+ st.markdown(f"[Proceed to Payment]({url})", unsafe_allow_html=True)
93
+
94
+ # ─── Footer ───────────────────────────────────────────────────────────────────
95
+ st.markdown("---")
96
+ st.markdown(
97
+ "<p style='text-align:center; color:#888; font-size:0.9rem;'>"
98
+ "Powered by Streamlit β€’ FastAPI β€’ Celery β€’ Redis β€’ Hugging Face Spaces"
99
+ "</p>",
100
+ unsafe_allow_html=True,
101
+ )