|
import streamlit as st |
|
import requests |
|
import time |
|
|
|
|
|
GEMINI_API_KEY = st.secrets.get("GEMINI_API_KEY", "your-gemini-api-key") |
|
OPENAI_API_KEY = st.secrets.get("OPENAI_API_KEY", "your-openai-api-key") |
|
|
|
GEMINI_ENDPOINT = "https://generativelanguage.googleapis.com/v1/models/gemini-1.5-pro:generateContent" |
|
|
|
import openai |
|
openai.api_key = OPENAI_API_KEY |
|
|
|
def call_openai(prompt): |
|
try: |
|
response = openai.ChatCompletion.create( |
|
model="gpt-4", |
|
messages=[{"role": "user", "content": prompt}], |
|
temperature=0.7 |
|
) |
|
return response['choices'][0]['message']['content'] |
|
except Exception as e: |
|
return f"OpenAI Error: {str(e)}" |
|
|
|
def call_gemini(prompt): |
|
headers = {"Content-Type": "application/json"} |
|
params = {"key": GEMINI_API_KEY} |
|
payload = {"contents": [{"parts": [{"text": prompt}]}]} |
|
response = requests.post(GEMINI_ENDPOINT, headers=headers, params=params, json=payload) |
|
if response.status_code == 200: |
|
return response.json()['candidates'][0]['content']['parts'][0]['text'] |
|
else: |
|
return call_openai(prompt) |
|
|
|
st.set_page_config(page_title="AutoExec AI", layout="wide") |
|
st.title("π AutoExec AI: Autonomous AI Business Launcher") |
|
|
|
st.sidebar.header("Business Setup") |
|
niche = st.sidebar.text_input("Niche (e.g. fitness, pets)") |
|
ad_budget = st.sidebar.slider("Ad Budget per Day", 5, 100, 10) |
|
business_type = st.sidebar.selectbox("Business Type", ["Dropshipping", "Print-on-Demand", "Newsletter", "Course"]) |
|
platforms = st.sidebar.multiselect("E-Commerce Platforms", ["Shopify", "Gumroad", "WooCommerce"]) |
|
run = st.sidebar.button("Launch") |
|
|
|
if run: |
|
strategy = call_gemini(f"Give me a viral business idea in the {niche} niche using {business_type}") |
|
st.subheader("π Strategy") |
|
st.markdown(strategy) |
|
|
|
copy = call_gemini(f"Write a product description and landing page for a {niche} {business_type}") |
|
st.subheader("π Copy") |
|
st.markdown(copy) |
|
|
|
ads = call_gemini(f"Create a $ {ad_budget}/day ad campaign for a {niche} product.") |
|
st.subheader("πΈ Ad Campaign") |
|
st.markdown(ads) |
|
|
|
st.success("Business Ready to Deploy") |
|
|