File size: 1,644 Bytes
cbd6b1a
 
 
 
10c3c16
cbd6b1a
10c3c16
 
cbd6b1a
 
 
 
 
10c3c16
cbd6b1a
10c3c16
cbd6b1a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10c3c16
 
 
cbd6b1a
 
 
 
 
 
 
 
 
 
10c3c16
cbd6b1a
 
 
10c3c16
cbd6b1a
 
 
 
 
 
 
 
 
10c3c16
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
# 🤗 HuggingFace Spaces Deployment Guide

## 📌 Important: Branch Configuration

**HuggingFace Spaces uses the `main` branch only**.

### Current Status (2025-09-25)
- ✅ Using single `main` branch for all deployments
- ✅ All dependencies are properly configured
- ✅ aiofiles, aiosmtplib, and jinja2 are included in requirements.txt

## 🚀 Deployment Instructions

### Deploy to HuggingFace
```bash
# Always use main branch for HuggingFace
git checkout main
git push origin main
git push huggingface main
```

## 📋 Required Dependencies

The following must be in `requirements.txt` for HuggingFace deployment:
```
aiofiles>=23.2.1        # For async file operations in audit.py
aiosmtplib>=3.0.1       # For email notifications
jinja2>=3.1.3           # For email templates
email-validator>=2.0.0   # For email validation
```

## 🔧 Troubleshooting

### Module Import Errors
1. **Verify requirements.txt has all dependencies**
2. **Clear HuggingFace cache** - Settings → Factory Reboot
3. **Check deployment logs for specific errors**


## 📝 Best Practices

1. **Always test locally first**
   ```bash
   pip install -r requirements.txt
   python app.py
   ```

2. **Use pyproject.toml as source of truth**
   - Update dependencies in `pyproject.toml[hf]`
   - Regenerate requirements.txt when needed

3. **Monitor deployment logs** at:
   https://huggingface.co/spaces/neural-thinker/cidadao.ai-backend/logs

## 🎯 Current Configuration

- **Entry point**: `app.py` (default for HuggingFace)
- **Port**: 7860 (HuggingFace standard)
- **Branch**: `main` (HuggingFace default)
- **Python**: 3.11+

Last updated: 2025-09-25