Spaces:
Running
Running
File size: 3,131 Bytes
815d041 |
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# 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** π§ |