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** πŸ§