File size: 2,195 Bytes
c9c8879 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
import streamlit as st
import requests
import time
# Gemini + GPT-4 fallback support
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")
|