Spaces:
Running
Running
| # AI Friends Talk - Gradio Deployment Guide | |
| π Watch 3 AI friends with different personalities debate fun topics! | |
| ## π¨ IMPORTANT: Deployment Error Fix | |
| If you get the error **"It appears that one or more of your files contain valid Hugging Face secrets"**, follow these steps: | |
| ### For Hugging Face Spaces Deployment (CORRECT WAY) | |
| #### Method 1: Manual Upload (Recommended) | |
| 1. **Create a new Space** at https://huggingface.co/spaces | |
| 2. **Upload ONLY these files**: | |
| - `AI_Talk_Gradio.py` | |
| - `requirements.txt` | |
| - `.gitignore` (optional) | |
| 3. **DO NOT upload these files**: | |
| - β `.env` (contains API keys) | |
| - β `__pycache__/` folders | |
| - β `.gradio/` folders | |
| - β Certificate files (`.pem`) | |
| 4. **Add API keys as Secrets** in Space settings: | |
| - Go to your Space β Settings β Repository secrets | |
| - Add: `GROQ_API_KEY` = your_groq_api_key | |
| - Add: `GOOGLE_API_KEY` = your_google_api_key | |
| 5. **Space will auto-deploy** with the secrets! | |
| #### Method 2: Using huggingface_hub (Advanced) | |
| ```python | |
| from huggingface_hub import HfApi | |
| api = HfApi() | |
| api.upload_file( | |
| path_or_fileobj="AI_Talk_Gradio.py", | |
| path_in_repo="AI_Talk_Gradio.py", | |
| repo_id="your_username/your_space_name", | |
| repo_type="space" | |
| ) | |
| api.upload_file( | |
| path_or_fileobj="requirements.txt", | |
| path_in_repo="requirements.txt", | |
| repo_id="your_username/your_space_name", | |
| repo_type="space" | |
| ) | |
| ``` | |
| ### For Local Development | |
| 1. **Install dependencies:** | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| 2. **Create `.env` file:** | |
| ```bash | |
| GROQ_API_KEY=your_groq_api_key_here | |
| GOOGLE_API_KEY=your_google_api_key_here | |
| ``` | |
| 3. **Run the app:** | |
| ```bash | |
| python AI_Talk_Gradio.py | |
| ``` | |
| ## π€ AI Characters | |
| - π **Alex** (Groq llama3-70b): Witty debater | |
| - π **Blake** (Gemini 2.0): Creative optimist | |
| - π§ **Charlie** (Gemini 1.5): Logical analyst | |
| ## β¨ Features | |
| - π Multi-language support (English/TiαΊΏng Viα»t/Deutsch) | |
| - π― Custom or predefined topics | |
| - π¬ Join the conversation as 4th participant | |
| - π¨ Beautiful gradient UI with animations | |
| - π± Mobile responsive design | |
| - π Auto-conversation flow | |
| - β‘ Real-time AI responses | |
| ## π Files Structure for Deployment | |
| ``` | |
| AI_Game/ | |
| βββ AI_Talk_Gradio.py β Main app file | |
| βββ requirements.txt β Dependencies | |
| βββ .gitignore β Ignore sensitive files | |
| βββ README_Deploy.md βΉοΈ This guide | |
| βββ .env β DO NOT UPLOAD (contains secrets) | |
| βββ __pycache__/ β DO NOT UPLOAD (Python cache) | |
| ``` | |
| ## π API Keys Required | |
| 1. **Groq API Key**: Get from https://console.groq.com/ | |
| 2. **Google API Key**: Get from https://ai.google.dev/gemini-api | |
| ## π§ Troubleshooting | |
| - **"BadRequestError: secrets detected"**: Remove `.env` file from upload | |
| - **"Model not found"**: Check API keys in Space secrets | |
| - **"Port already in use"**: App auto-selects available port | |
| - **Import errors**: Verify `requirements.txt` is uploaded | |
| Made by **Digitized Brains** π§ |