Update app.py
Browse files
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
|
| 9 |
if "page" not in st.session_state:
|
| 10 |
st.session_state.page = "Home"
|
| 11 |
|
| 12 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
st.sidebar.title("AutoExec AI")
|
| 14 |
-
st.
|
| 15 |
"Go to",
|
| 16 |
-
|
| 17 |
-
index=
|
| 18 |
key="page",
|
| 19 |
)
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
show_landing()
|
| 24 |
|
| 25 |
-
elif
|
| 26 |
st.header("π Launch a New AI Business")
|
| 27 |
niche = st.text_input("Niche (e.g., fitness)")
|
| 28 |
-
business_type = st.selectbox(
|
|
|
|
|
|
|
|
|
|
| 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
|
| 36 |
show_logs()
|
| 37 |
|
| 38 |
-
elif
|
| 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.")
|