# ExVidPro — Gemini AI Run Prompt Setup Guide

## What You Have

| File | Purpose |
|---|---|
| `prompts_dashboard_gemini.html` | The main dashboard with 250 prompts + Run Prompt feature |
| `gemini_proxy.py` | The backend proxy server that connects to Gemini AI |
| `SETUP_GUIDE.md` | This file |

---

## How It Works

```
Browser (dashboard) → gemini_proxy.py → Gemini API → streams back → dashboard
```

1. User clicks **⚡ Run Prompt** on any prompt card
2. A modal opens showing the full prompt + a text box for custom details
3. User types their product/brand info (optional but recommended)
4. User clicks **Run Prompt with Gemini**
5. The dashboard calls your local proxy server
6. The proxy sends the combined prompt to Gemini AI
7. The AI response streams back word-by-word into the dashboard

---

## Quick Start (Local)

### Step 1 — Get a Free Gemini API Key
1. Go to [https://aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey)
2. Sign in with your Google account
3. Click **Create API Key**
4. Copy the key

### Step 2 — Install Requirements
```bash
pip3 install flask flask-cors google-generativeai
```

### Step 3 — Start the Proxy Server
```bash
export GEMINI_API_KEY="your-key-here"
python3 gemini_proxy.py
```
You should see: `🚀 ExVidPro Gemini Proxy running on http://localhost:8090`

### Step 4 — Open the Dashboard
Open `prompts_dashboard_gemini.html` in your browser.

### Step 5 — Connect in the Dashboard
In the dark bar at the top of the dashboard:
- Paste your Gemini API key in the **Gemini API Key** field
- Leave Proxy URL as `http://localhost:8090`
- Click **Save & Connect**

You should see **✓ Proxy online** appear.

### Step 6 — Run Your First Prompt
- Click **⚡ Run Prompt** on any card
- Type your product details in the text box
- Click **⚡ Run Prompt with Gemini**
- Watch the AI write your full video script in real time!

---

## Deploying to a Server (cPanel / VPS)

### Option A — Run Proxy on Same Server
1. Upload both files to your server
2. Install requirements: `pip3 install flask flask-cors google-generativeai`
3. Start the proxy: `GEMINI_API_KEY="your-key" python3 gemini_proxy.py`
4. Update the Proxy URL in the dashboard to your server's address

### Option B — Use a Different Port
```bash
GEMINI_API_KEY="your-key" PROXY_PORT=5000 python3 gemini_proxy.py
```

### Option C — Keep API Key Server-Side (Recommended for Production)
Set the key as an environment variable on the server — users won't need to enter it:
```bash
export GEMINI_API_KEY="your-key-here"
python3 gemini_proxy.py
```
Leave the API Key field blank in the dashboard — the proxy will use the server's key.

---

## What Gemini Generates

For each prompt, Gemini produces a **complete production package**:

1. **Full Video Script** — scene-by-scene breakdown
2. **Visual Style Notes** — for each scene
3. **Voiceover Copy** — word-for-word dialogue
4. **Timing Guide** — seconds per scene
5. **Music/Sound Design** — suggestions
6. **Production Checklist** — 5 key items

---

## Tips for Best Results

- **Be specific in your custom details** — include product name, target audience, brand colors, tone, and CTA
- **The more context you give, the better the script** — mention your industry, competitors, key benefits
- **Copy the response** — use the "Copy Response" button to save the full script
- **Combine with the base prompt** — the AI uses both the base animation prompt AND your custom details

---

## Troubleshooting

| Problem | Solution |
|---|---|
| "Could not connect to proxy" | Make sure `gemini_proxy.py` is running |
| "API key not valid" | Double-check your key at aistudio.google.com |
| Response is slow | Normal — Gemini takes 5-15 seconds for a full script |
| Proxy shows "offline" | Restart with `python3 gemini_proxy.py` |

---

*ExVidPro — ExplainerVideoProduction.com*
