| --- |
| license: apache-2.0 |
| title: YouTube Competitor Analysis |
| sdk: gradio |
| emoji: π |
| colorFrom: red |
| colorTo: yellow |
| pinned: false |
| short_description: This application analyzes competitor YouTube channels and de |
| --- |
| # YouTube Competitor Analysis (Global) |
|
|
| This application analyzes competitor YouTube channels and detects global trending clusters of people mentioned in videos using Gemini (Google Generative AI) and the YouTube Data API. |
|
|
| This README explains how to run the app and where to enter your API keys in the UI. |
|
|
| ## Key points |
| - API keys are entered via the Gradio UI (Data Update tab) β they are not read automatically from environment variables. |
| - Keys are stored in memory for the running session only (not persisted to disk). |
|
|
| ## Requirements |
| The project has a `requirements.txt`. From your project root on Windows PowerShell run: |
|
|
| ```powershell |
| python -m pip install -r .\requirements.txt |
| ``` |
|
|
| If you don't have a virtual environment, consider creating one first: |
|
|
| ```powershell |
| python -m venv venv |
| .\venv\Scripts\Activate.ps1 |
| python -m pip install -r .\requirements.txt |
| ``` |
|
|
| ## Run the app |
|
|
| From the repository root run: |
|
|
| ```powershell |
| python .\app.py |
| ``` |
|
|
| Gradio will print a local URL (and possibly a public share URL). Open the local URL in your browser. |
|
|
| ## Where to enter API keys |
| 1. Open the Gradio UI and go to the "π Data Update" tab. |
| 2. Enter your keys in the two password-style text boxes: |
| - `YouTube API Key` β for the YouTube Data API (developerKey) |
| - `Gemini API Key` β for the Google Generative AI client |
| 3. Click `Apply API Keys`. The status box will show whether configuration succeeded. |
|
|
| After applying keys you can use: |
| - `Start Global Data Update` to fetch video data and run person-detection logic. |
| - Channel management features (Add/Delete/Update) which require a configured YouTube client. |
|
|
| ## Behavior & notes |
| - Keys are kept in memory for the running Gradio session. If you stop the app you must re-enter them. |
| - If you see messages like `YouTube API key is not set.` or `AI features will not work`, confirm you applied the keys successfully. |
| - The app does not currently persist keys to disk. If you want persistence (encrypted local store or OS keyring) I can add that. |
|
|
| ## Troubleshooting |
| - Missing dependencies: re-install with `pip install -r requirements.txt`. |
| - If the YouTube API returns quota errors, check your API quota in Google Cloud Console. |
| - If Gemini calls fail, ensure the Gemini key is valid and that the `google-generativeai` client package version in `requirements.txt` is compatible. |
|
|
| ## Next steps (optional) |
| - Persist keys securely between sessions (encrypted file or OS keyring). |
| - Pre-fill UI inputs from environment variables for dev convenience. |
| - Add unit tests to mock Gemini/YouTube clients and verify wiring. |
|
|
| If you'd like one of those, tell me which and I will implement it. |