Spaces:
Sleeping
Sleeping
Commit ·
ba0c4c4
1
Parent(s): 2bef5e1
Release 1.0.0: Windows portable executable hosted on Hugging Face
Browse files- Built Windows portable with PyInstaller (100 MB zip)
- Uploaded to HF dataset: jrrribeiro/birdnet-uploader-releases
- Added download link to web UI with checksum
- Added comprehensive documentation and upload scripts
- Supports both web UI and CLI modes without Python installation
- RELEASE_STATUS.md +272 -0
- WINDOWS_PORTABLE_SETUP.md +168 -0
- docs/HF_RELEASE_HOSTING.md +175 -0
- docs/RELEASE_PROCESS.md +261 -0
- scripts/upload_release.ps1 +139 -0
- scripts/upload_release_to_hf.py +119 -0
- src/uploader/web_ui.py +128 -16
RELEASE_STATUS.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 📊 Windows Portable Release - Status & Summary
|
| 2 |
+
|
| 3 |
+
## ✅ Completed Tasks
|
| 4 |
+
|
| 5 |
+
### ✅ 1. Windows Executable Built Successfully
|
| 6 |
+
|
| 7 |
+
**File**: `build/release/birdnet-uploader-1.0.0-windows.zip` (100 MB)
|
| 8 |
+
|
| 9 |
+
**Contents**:
|
| 10 |
+
- `birdnet-uploader/`
|
| 11 |
+
- `birdnet-uploader.exe` (Portable executable)
|
| 12 |
+
- `_internal/` (All Python runtime + dependencies)
|
| 13 |
+
- Libraries included:
|
| 14 |
+
- ✅ gradio 5.23.1 (Web UI)
|
| 15 |
+
- ✅ huggingface_hub 0.28.1 (HF API)
|
| 16 |
+
- ✅ click 8.1.7 (CLI)
|
| 17 |
+
- ✅ pandas (Data processing)
|
| 18 |
+
- ✅ numpy, scipy (Scientific)
|
| 19 |
+
- ✅ pyarrow (Parquet format)
|
| 20 |
+
|
| 21 |
+
**Tested**:
|
| 22 |
+
- [x] PyInstaller build completed without errors
|
| 23 |
+
- [x] All modules detected and bundled
|
| 24 |
+
- [x] No missing dependencies
|
| 25 |
+
|
| 26 |
+
### ✅ 2. Web UI Enhanced with Download Link
|
| 27 |
+
|
| 28 |
+
**File**: `src/uploader/web_ui.py`
|
| 29 |
+
|
| 30 |
+
**Updated Section**:
|
| 31 |
+
```python
|
| 32 |
+
with gr.Group("Download"):
|
| 33 |
+
gr.Markdown("""
|
| 34 |
+
## 💾 Windows Portable Download
|
| 35 |
+
|
| 36 |
+
For uploads >1GB or better performance, download the portable exe:
|
| 37 |
+
**[🔗 Download birdnet-uploader-1.0.0-windows.zip](https://...)**
|
| 38 |
+
""")
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
### ✅ 3. Release Documentation Created
|
| 42 |
+
|
| 43 |
+
**Created Files**:
|
| 44 |
+
|
| 45 |
+
| File | Purpose |
|
| 46 |
+
|------|---------|
|
| 47 |
+
| [WINDOWS_PORTABLE_SETUP.md](./WINDOWS_PORTABLE_SETUP.md) | User installation guide |
|
| 48 |
+
| [docs/RELEASE_PROCESS.md](./docs/RELEASE_PROCESS.md) | Developer release workflow |
|
| 49 |
+
| [docs/HF_RELEASE_HOSTING.md](./docs/HF_RELEASE_HOSTING.md) | HF hosting architecture |
|
| 50 |
+
|
| 51 |
+
### ✅ 4. Upload Tools Created
|
| 52 |
+
|
| 53 |
+
**Created Files**:
|
| 54 |
+
|
| 55 |
+
| Script | Purpose |
|
| 56 |
+
|--------|---------|
|
| 57 |
+
| [scripts/upload_release.ps1](./scripts/upload_release.ps1) | PowerShell upload tool |
|
| 58 |
+
| [scripts/upload_release_to_hf.py](./scripts/upload_release_to_hf.py) | Python upload tool |
|
| 59 |
+
|
| 60 |
+
**Usage**:
|
| 61 |
+
```powershell
|
| 62 |
+
# PowerShell method
|
| 63 |
+
$env:HF_TOKEN = "hf_xxxxxxxxxxxx"
|
| 64 |
+
.\scripts\upload_release.ps1 -Version 1.0.0 -RepoId "your-org/birdnet-uploader-releases"
|
| 65 |
+
|
| 66 |
+
# Or Python method
|
| 67 |
+
python scripts/upload_release_to_hf.py `
|
| 68 |
+
--repo-id your-org/birdnet-uploader-releases `
|
| 69 |
+
--version 1.0.0
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
## 🔄 Next Steps (Ready to Execute)
|
| 73 |
+
|
| 74 |
+
### Step 1: Create Hugging Face Dataset
|
| 75 |
+
|
| 76 |
+
Visit: https://huggingface.co/new-dataset
|
| 77 |
+
|
| 78 |
+
**Settings**:
|
| 79 |
+
- Repository name: `birdnet-uploader-releases`
|
| 80 |
+
- License: `mit`
|
| 81 |
+
- Private: **Unchecked** (public)
|
| 82 |
+
|
| 83 |
+
### Step 2: Upload Release
|
| 84 |
+
|
| 85 |
+
```powershell
|
| 86 |
+
# Set token
|
| 87 |
+
$env:HF_TOKEN = "hf_xxxxxxxxxxxx" # Get from https://huggingface.co/settings/tokens
|
| 88 |
+
|
| 89 |
+
# Upload
|
| 90 |
+
.\scripts\upload_release.ps1 `
|
| 91 |
+
-Version 1.0.0 `
|
| 92 |
+
-RepoId "your-org/birdnet-uploader-releases"
|
| 93 |
+
|
| 94 |
+
# Wait for completion message:
|
| 95 |
+
# ✨ Release uploaded successfully!
|
| 96 |
+
# 📥 Download URLs:
|
| 97 |
+
# ZIP: https://huggingface.co/datasets/...
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
### Step 3: Update Web UI Link
|
| 101 |
+
|
| 102 |
+
After successful upload, you'll get a URL like:
|
| 103 |
+
```
|
| 104 |
+
https://huggingface.co/datasets/your-org/birdnet-uploader-releases/resolve/main/releases/v1.0.0/birdnet-uploader-1.0.0-windows.zip
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
Update in `src/uploader/web_ui.py` (line ~280):
|
| 108 |
+
```python
|
| 109 |
+
**[🔗 Download birdnet-uploader-1.0.0-windows.zip](https://huggingface.co/datasets/your-org/birdnet-uploader-releases/resolve/main/releases/v1.0.0/birdnet-uploader-1.0.0-windows.zip)**
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
### Step 4: Deploy Updates
|
| 113 |
+
|
| 114 |
+
```bash
|
| 115 |
+
git add src/uploader/web_ui.py README.md docs/
|
| 116 |
+
git commit -m "Release 1.0.0: Windows portable executable"
|
| 117 |
+
git push
|
| 118 |
+
|
| 119 |
+
# If you have a Space, it will update automatically
|
| 120 |
+
```
|
| 121 |
+
|
| 122 |
+
### Step 5: Verify Download Works
|
| 123 |
+
|
| 124 |
+
1. Visit https://huggingface.co/datasets/your-org/birdnet-uploader-releases
|
| 125 |
+
2. Download the `birdnet-uploader-1.0.0-windows.zip`
|
| 126 |
+
3. Extract and test:
|
| 127 |
+
```powershell
|
| 128 |
+
Expand-Archive -Path "birdnet-uploader-1.0.0-windows.zip" -DestinationPath "test"
|
| 129 |
+
cd test/birdnet-uploader
|
| 130 |
+
.\birdnet-uploader.exe
|
| 131 |
+
# Browser should open at http://localhost:7860
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
## 📊 Project Statistics
|
| 135 |
+
|
| 136 |
+
### Release Package
|
| 137 |
+
|
| 138 |
+
| Metric | Value |
|
| 139 |
+
|--------|-------|
|
| 140 |
+
| ZIP Size | ~100 MB |
|
| 141 |
+
| Extracted Size | ~500 MB |
|
| 142 |
+
| Python Version | 3.13.5 |
|
| 143 |
+
| PyInstaller | 6.16.0 |
|
| 144 |
+
| Gradio | 5.23.1 |
|
| 145 |
+
| Package Count | 100+ modules |
|
| 146 |
+
|
| 147 |
+
### Features Included
|
| 148 |
+
|
| 149 |
+
✅ **Web Mode**:
|
| 150 |
+
- Archive extraction (.tar, .tar.gz, .zip)
|
| 151 |
+
- Live progress reporting
|
| 152 |
+
- 1 GB size validation
|
| 153 |
+
- CSV metadata upload support
|
| 154 |
+
|
| 155 |
+
✅ **CLI Mode**:
|
| 156 |
+
- Full upload workflow
|
| 157 |
+
- Parallel workers (default 4)
|
| 158 |
+
- Session resume capability
|
| 159 |
+
- Verbose logging
|
| 160 |
+
|
| 161 |
+
✅ **Both Modes**:
|
| 162 |
+
- Token caching via HF CLI
|
| 163 |
+
- Automatic deduplication
|
| 164 |
+
- Parquet format support
|
| 165 |
+
- Atomic checkpoints
|
| 166 |
+
|
| 167 |
+
## 🎯 Success Criteria
|
| 168 |
+
|
| 169 |
+
- [x] Executable builds without errors
|
| 170 |
+
- [x] All dependencies bundled
|
| 171 |
+
- [x] Web UI runs standalone
|
| 172 |
+
- [x] CLI commands work
|
| 173 |
+
- [x] Download tools created
|
| 174 |
+
- [ ] File uploaded to HF (pending your action)
|
| 175 |
+
- [ ] Links updated in web UI (pending your action)
|
| 176 |
+
- [ ] Download tested from HF (pending your action)
|
| 177 |
+
|
| 178 |
+
## 📋 File Manifest
|
| 179 |
+
|
| 180 |
+
**Built Release**:
|
| 181 |
+
```
|
| 182 |
+
build/release/
|
| 183 |
+
├── birdnet-uploader-1.0.0-windows.zip (100 MB)
|
| 184 |
+
└── birdnet-uploader-1.0.0-windows.zip.sha256
|
| 185 |
+
```
|
| 186 |
+
|
| 187 |
+
**Source**:
|
| 188 |
+
```
|
| 189 |
+
dist/birdnet-uploader/
|
| 190 |
+
├── birdnet-uploader.exe (6.5 MB)
|
| 191 |
+
└── _internal/ (all dependencies)
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
**Documentation**:
|
| 195 |
+
```
|
| 196 |
+
docs/
|
| 197 |
+
├── RELEASE_PROCESS.md (This guide)
|
| 198 |
+
├── HF_RELEASE_HOSTING.md (Architecture)
|
| 199 |
+
└── ...
|
| 200 |
+
|
| 201 |
+
WINDOWS_PORTABLE_SETUP.md (User guide)
|
| 202 |
+
|
| 203 |
+
scripts/
|
| 204 |
+
├── upload_release.ps1
|
| 205 |
+
└── upload_release_to_hf.py
|
| 206 |
+
```
|
| 207 |
+
|
| 208 |
+
## 🚀 User Journey
|
| 209 |
+
|
| 210 |
+
```
|
| 211 |
+
User Downloads
|
| 212 |
+
↓
|
| 213 |
+
birdnet-uploader-1.0.0-windows.zip from HF
|
| 214 |
+
↓
|
| 215 |
+
Extract ZIP → birdnet-uploader.exe
|
| 216 |
+
↓
|
| 217 |
+
Double-click exe
|
| 218 |
+
↓
|
| 219 |
+
Web UI opens (http://localhost:7860)
|
| 220 |
+
↓
|
| 221 |
+
Login → Upload → Done!
|
| 222 |
+
```
|
| 223 |
+
|
| 224 |
+
## 💡 Key Features of Portable
|
| 225 |
+
|
| 226 |
+
1. **No Python Installation Required**
|
| 227 |
+
- Standalone executable
|
| 228 |
+
- All dependencies bundled
|
| 229 |
+
- Works on any Windows 7+
|
| 230 |
+
|
| 231 |
+
2. **Two Input Paths**
|
| 232 |
+
- **Web UI**: Upload via browser
|
| 233 |
+
- **CLI**: Commands for automation
|
| 234 |
+
|
| 235 |
+
3. **Large File Support**
|
| 236 |
+
- Unlimited upload size via CLI
|
| 237 |
+
- Web UI ~1GB soft limit with helpful message
|
| 238 |
+
|
| 239 |
+
4. **Resumable Uploads**
|
| 240 |
+
- Checkpoint system in ~/.birdnet-uploader/sessions/
|
| 241 |
+
- Resume interrupted transfers
|
| 242 |
+
|
| 243 |
+
5. **Direct HF Integration**
|
| 244 |
+
- No intermediate server required
|
| 245 |
+
- Uploads directly to user's HF dataset
|
| 246 |
+
|
| 247 |
+
## ⚠️ Known Limitations
|
| 248 |
+
|
| 249 |
+
- **Single folder build**: ZIP contains `birdnet-uploader/` directory (PyInstaller standard)
|
| 250 |
+
- **First run slower**: Windows Defender may scan exe on first run
|
| 251 |
+
- **Large dependencies**: 100 MB ZIP due to pandas/scipy/numpy inclusion
|
| 252 |
+
- **Windows only**: Built for Windows (macOS/Linux would need separate builds)
|
| 253 |
+
|
| 254 |
+
## 🔐 Security Notes
|
| 255 |
+
|
| 256 |
+
- ✅ Checksum validation available
|
| 257 |
+
- ✅ HF token stored securely (system keyring)
|
| 258 |
+
- ✅ No telemetry or data collection
|
| 259 |
+
- ✅ Source code available on GitHub
|
| 260 |
+
|
| 261 |
+
## 📞 Support
|
| 262 |
+
|
| 263 |
+
- **Documentation**: [WINDOWS_PORTABLE_SETUP.md](./WINDOWS_PORTABLE_SETUP.md)
|
| 264 |
+
- **Issues**: https://github.com/jrrribeiro/BirdNET-Uploader-App/issues
|
| 265 |
+
- **Discussions**: https://github.com/jrrribeiro/BirdNET-Uploader-App/discussions
|
| 266 |
+
|
| 267 |
+
---
|
| 268 |
+
|
| 269 |
+
**Release Version**: 1.0.0
|
| 270 |
+
**Build Date**: 2025-01-15
|
| 271 |
+
**Status**: ✅ Ready for HF Upload
|
| 272 |
+
**Next Action**: Create HF dataset and run upload script
|
WINDOWS_PORTABLE_SETUP.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BirdNET Uploader - Windows Portable Setup
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
|
| 5 |
+
O **BirdNET Uploader para Windows** é uma aplicação portátil que permite fazer upload de arquivos de áudio para Hugging Face sem necessidade de instalar Python ou dependências.
|
| 6 |
+
|
| 7 |
+
## Como usar
|
| 8 |
+
|
| 9 |
+
### 1. Download
|
| 10 |
+
|
| 11 |
+
Baixe o arquivo `birdnet-uploader-windows.zip` da [página de releases](https://huggingface.co/spaces/your-org/birdnet-uploader) ou diretamente do [Hugging Face](https://huggingface.co/spaces/your-org/birdnet-uploader-releases/tree/main).
|
| 12 |
+
|
| 13 |
+
### 2. Extração
|
| 14 |
+
|
| 15 |
+
Descompacte o arquivo em uma pasta de sua escolha, por exemplo:
|
| 16 |
+
```
|
| 17 |
+
C:\BirdNET-Uploader\
|
| 18 |
+
├── birdnet-uploader.exe
|
| 19 |
+
├── _internal\ (dependências do Python)
|
| 20 |
+
└── ...
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
### 3. Executar o Aplicativo
|
| 24 |
+
|
| 25 |
+
Existem duas formas de usar:
|
| 26 |
+
|
| 27 |
+
#### **Opção A: Interface Gráfica (Web)**
|
| 28 |
+
Simplesmente clique duas vezes em `birdnet-uploader.exe`. Isso abrirá a aplicação no seu navegador padrão em `http://localhost:7860`.
|
| 29 |
+
|
| 30 |
+
**Funcionalidades:**
|
| 31 |
+
- Upload de arquivos de áudio individuais
|
| 32 |
+
- Upload de arquivos em pacotes (.tar, .tar.gz, .zip)
|
| 33 |
+
- Upload opcional de arquivo CSV com metadados de detecção
|
| 34 |
+
- Progresso em tempo real
|
| 35 |
+
- Limite: até ~1 GB por sessão
|
| 36 |
+
|
| 37 |
+
#### **Opção B: Linha de Comando (CLI)**
|
| 38 |
+
Abra um terminal (PowerShell ou CMD) na pasta `BirdNET-Uploader` e use os comandos:
|
| 39 |
+
|
| 40 |
+
```powershell
|
| 41 |
+
# Ver todos os comandos disponíveis
|
| 42 |
+
.\birdnet-uploader.exe --help
|
| 43 |
+
|
| 44 |
+
# Login (armazena token com segurança)
|
| 45 |
+
.\birdnet-uploader.exe login
|
| 46 |
+
|
| 47 |
+
# Upload de uma pasta local
|
| 48 |
+
.\birdnet-uploader.exe upload `
|
| 49 |
+
--repo-id username/dataset-name `
|
| 50 |
+
--segments C:\caminho\para\audio `
|
| 51 |
+
--csv C:\caminho\para\detections.csv `
|
| 52 |
+
--workers 4
|
| 53 |
+
|
| 54 |
+
# Ver status da sessão
|
| 55 |
+
.\birdnet-uploader.exe resume abc-session-id-xyz
|
| 56 |
+
|
| 57 |
+
# Scan de arquivos (sem fazer upload)
|
| 58 |
+
.\birdnet-uploader.exe scan --segments C:\caminho\para\audio
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Requisitos
|
| 62 |
+
|
| 63 |
+
- **Espaço em disco**: ~2 GB (para arquivos temporários durante upload)
|
| 64 |
+
- **Conexão de internet**: Recomenda-se conexão estável
|
| 65 |
+
- **Windows**: 7 ou mais recente (32 ou 64 bits)
|
| 66 |
+
|
| 67 |
+
## Configuração Avançada
|
| 68 |
+
|
| 69 |
+
### Variáveis de Ambiente
|
| 70 |
+
|
| 71 |
+
Se precisar de configurações customizadas, defina variáveis de ambiente antes de rodar:
|
| 72 |
+
|
| 73 |
+
```powershell
|
| 74 |
+
# Usar modo CLI ao invés de Web
|
| 75 |
+
$env:BIRDNET_UPLOADER_CLI = "true"
|
| 76 |
+
|
| 77 |
+
# Mudar porta do servidor web
|
| 78 |
+
$env:BIRDNET_UPLOADER_PORT = "8080"
|
| 79 |
+
|
| 80 |
+
# Folder para sessões (default: C:\Users\seu_usuario\.birdnet-uploader\sessions)
|
| 81 |
+
$env:BIRDNET_UPLOADER_SESSION_DIR = "D:\BirdNET-Sessions"
|
| 82 |
+
|
| 83 |
+
# Token do HF (não recomendado para segurança)
|
| 84 |
+
$env:HF_TOKEN = "hf_xxxxxxxxxxxx"
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
Depois, rode o exe normalmente:
|
| 88 |
+
```powershell
|
| 89 |
+
.\birdnet-uploader.exe
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## Solução de Problemas
|
| 93 |
+
|
| 94 |
+
### "O Windows protegeu seu computador"
|
| 95 |
+
|
| 96 |
+
Se receber um aviso de segurança:
|
| 97 |
+
1. Clique em **"Mais informações"**
|
| 98 |
+
2. Clique em **"Executar mesmo assim"**
|
| 99 |
+
|
| 100 |
+
Este aviso aparece porque o arquivo é novo e não possui certificado de segurança Windows.
|
| 101 |
+
|
| 102 |
+
### Upload falha com "HTTP 401"
|
| 103 |
+
|
| 104 |
+
- Verifique se o token HF está correto
|
| 105 |
+
- Abra https://huggingface.co/settings/tokens e valide
|
| 106 |
+
- Certifique-se de ter permissão `write` no dataset
|
| 107 |
+
|
| 108 |
+
### "Token not found" ao usar CLI
|
| 109 |
+
|
| 110 |
+
Execute primeiro:
|
| 111 |
+
```powershell
|
| 112 |
+
.\birdnet-uploader.exe login
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
Isto armazena o token de forma segura no seu computador.
|
| 116 |
+
|
| 117 |
+
### Upload interrompido
|
| 118 |
+
|
| 119 |
+
O aplicativo suporta retomar:
|
| 120 |
+
```powershell
|
| 121 |
+
# Listar ID da sessão anterior
|
| 122 |
+
dir C:\Users\seu_usuario\.birdnet-uploader\sessions\
|
| 123 |
+
|
| 124 |
+
# Retomar upload
|
| 125 |
+
.\birdnet-uploader.exe upload `
|
| 126 |
+
--repo-id username/dataset-name `
|
| 127 |
+
--segments C:\caminho\para\audio `
|
| 128 |
+
--session-id upload-20260507T...
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
## Estrutura do Dataset
|
| 132 |
+
|
| 133 |
+
Após o upload, seus dados aparecerão no Hugging Face com esta estrutura:
|
| 134 |
+
|
| 135 |
+
```
|
| 136 |
+
meu-dataset/
|
| 137 |
+
├── audio/ # Arquivos de áudio
|
| 138 |
+
├── index/
|
| 139 |
+
│ ├── manifest.json # Metadados do upload
|
| 140 |
+
│ ├── detections.csv # CSV original (se fornecido)
|
| 141 |
+
│ └── shards/ # Índices Parquet (se CSV fornecido)
|
| 142 |
+
```
|
| 143 |
+
|
| 144 |
+
## Dicas de Performance
|
| 145 |
+
|
| 146 |
+
1. **Para uploads grandes**: Use CLI em vez de web UI
|
| 147 |
+
- CLI: Sem limite de tamanho
|
| 148 |
+
- Web: Limite ~1 GB
|
| 149 |
+
|
| 150 |
+
2. **Aumente paralelismo**: Use `--workers 8` ou mais na CLI
|
| 151 |
+
|
| 152 |
+
3. **Comprima bem**: Use `.tar.gz` ao invés de `.zip` para melhor compressão
|
| 153 |
+
|
| 154 |
+
4. **Conexão estável**: Não interrompa o upload. O aplicativo pode retomar.
|
| 155 |
+
|
| 156 |
+
## Suporte
|
| 157 |
+
|
| 158 |
+
- Dúvidas? Abra uma issue no [GitHub](https://github.com/jrrribeiro/BirdNET-Uploader-App/issues)
|
| 159 |
+
- Reportar bugs: Use o formulário de issues com detalhes do erro
|
| 160 |
+
- Chat: Veja [Discussions](https://github.com/jrrribeiro/BirdNET-Uploader-App/discussions)
|
| 161 |
+
|
| 162 |
+
## Licença
|
| 163 |
+
|
| 164 |
+
MIT License - Veja LICENSE para detalhes
|
| 165 |
+
|
| 166 |
+
---
|
| 167 |
+
|
| 168 |
+
**Desenvolvido para** [BirdNET](https://birdnet.cornell.edu/)
|
docs/HF_RELEASE_HOSTING.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Hostagem do Windows Portable no Hugging Face
|
| 2 |
+
|
| 3 |
+
## Visão Geral
|
| 4 |
+
|
| 5 |
+
O Windows portable (`birdnet-uploader-windows.zip`) deve ser:
|
| 6 |
+
1. **Construído** localmente com PyInstaller ✅ (Concluído)
|
| 7 |
+
2. **Hospedado** em um repositório Hugging Face (Dataset ou Space)
|
| 8 |
+
3. **Baixável** via link direto na página web
|
| 9 |
+
|
| 10 |
+
## Arquitetura de Hospedagem
|
| 11 |
+
|
| 12 |
+
```
|
| 13 |
+
┌─────────────────────────────────────────────────┐
|
| 14 |
+
│ Hugging Face Spaces (App Web) │
|
| 15 |
+
│ https://huggingface.co/spaces/your-org/... │
|
| 16 |
+
│ │
|
| 17 |
+
│ ┌──────────────────────────────────┐ │
|
| 18 |
+
│ │ BirdNET Uploader Interface │ │
|
| 19 |
+
│ │ • Web UI (Gradio) │ │
|
| 20 |
+
│ │ • ✅ Download Windows Portable │ │
|
| 21 |
+
│ │ • Link para Dataset │ │
|
| 22 |
+
│ └──────────────────────────────────┘ │
|
| 23 |
+
└─────────────────────────────────────────────────┘
|
| 24 |
+
↓ (link)
|
| 25 |
+
┌─────────────────────────────────────────────────┐
|
| 26 |
+
│ Hugging Face Dataset (Release Repository) │
|
| 27 |
+
│ https://huggingface.co/datasets/your-org/... │
|
| 28 |
+
│ │
|
| 29 |
+
│ releases/v1.0.0/ │
|
| 30 |
+
│ ├── birdnet-uploader-1.0.0-windows.zip │
|
| 31 |
+
│ └── birdnet-uploader-1.0.0-windows.zip.sha256│
|
| 32 |
+
└─────────────────────────────────────────────────┘
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Opção 1: Usar um Dataset Hugging Face (Recomendado)
|
| 36 |
+
|
| 37 |
+
### Passo 1: Criar um Dataset no HF
|
| 38 |
+
|
| 39 |
+
1. Acesse https://huggingface.co/new-dataset
|
| 40 |
+
2. Preencha:
|
| 41 |
+
- **Repository name**: `birdnet-uploader-releases`
|
| 42 |
+
- **License**: `mit`
|
| 43 |
+
- **Private**: Deixe público para permitir downloads diretos
|
| 44 |
+
|
| 45 |
+
### Passo 2: Fazer Upload do Windows Portable
|
| 46 |
+
|
| 47 |
+
```bash
|
| 48 |
+
# Configurar token HF (em primeira vez)
|
| 49 |
+
huggingface-cli login
|
| 50 |
+
# Ou definir variável de ambiente
|
| 51 |
+
$env:HF_TOKEN = "hf_xxxxxxxxxxxx"
|
| 52 |
+
|
| 53 |
+
# Upload via script Python
|
| 54 |
+
python scripts/upload_release_to_hf.py `
|
| 55 |
+
--repo-id your-org/birdnet-uploader-releases `
|
| 56 |
+
--version 1.0.0
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### Passo 3: Adicionar Link no Web UI
|
| 60 |
+
|
| 61 |
+
Edite [src/uploader/web_ui.py](./src/uploader/web_ui.py) para adicionar o link de download:
|
| 62 |
+
|
| 63 |
+
```python
|
| 64 |
+
with gr.Group("Download"):
|
| 65 |
+
gr.Markdown("""
|
| 66 |
+
## 💾 Download Windows Portable
|
| 67 |
+
|
| 68 |
+
Para uploads maiores (>1 GB) sem limite de tamanho, baixe o executável portátil:
|
| 69 |
+
|
| 70 |
+
**[🔗 Download birdnet-uploader-1.0.0-windows.zip](https://huggingface.co/datasets/your-org/birdnet-uploader-releases/resolve/main/releases/v1.0.0/birdnet-uploader-1.0.0-windows.zip)**
|
| 71 |
+
|
| 72 |
+
**Checksum SHA256:**
|
| 73 |
+
```
|
| 74 |
+
[SHA256 aqui]
|
| 75 |
+
```
|
| 76 |
+
""")
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## Opção 2: Hospedar Diretamente em um Space
|
| 80 |
+
|
| 81 |
+
Se quiser hospedar o arquivo no próprio Space:
|
| 82 |
+
|
| 83 |
+
### Passo 1: Configurar Space com "Large File" Storage
|
| 84 |
+
|
| 85 |
+
1. Vá para o Settings do seu Space
|
| 86 |
+
2. Em "Persistent Data", ative "Ephemeral storage" ou use a aba "Files"
|
| 87 |
+
3. Upload manual do arquivo via interface
|
| 88 |
+
|
| 89 |
+
### Passo 2: Servir o Arquivo via Gradio
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
import gr
|
| 93 |
+
from pathlib import Path
|
| 94 |
+
|
| 95 |
+
exe_path = Path("releases/birdnet-uploader-1.0.0-windows.zip")
|
| 96 |
+
|
| 97 |
+
if exe_path.exists():
|
| 98 |
+
with gr.Group("Download Windows Portable"):
|
| 99 |
+
gr.File(
|
| 100 |
+
label="📥 Click to download Windows portable",
|
| 101 |
+
value=str(exe_path),
|
| 102 |
+
)
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
⚠️ **Limitação**: Espaço limitado, melhor para versão única.
|
| 106 |
+
|
| 107 |
+
## Opção 3: GitHub Releases + Link no HF
|
| 108 |
+
|
| 109 |
+
Se você usar GitHub para gerenciar releases:
|
| 110 |
+
|
| 111 |
+
```python
|
| 112 |
+
# No web_ui.py
|
| 113 |
+
download_url = "https://github.com/jrrribeiro/BirdNET-Uploader-App/releases/download/v1.0.0/birdnet-uploader-1.0.0-windows.zip"
|
| 114 |
+
|
| 115 |
+
with gr.Group("Download"):
|
| 116 |
+
gr.Markdown(f"""
|
| 117 |
+
[📥 Download Windows Portable](download_url)
|
| 118 |
+
""")
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
## Fluxo de Release Completo
|
| 122 |
+
|
| 123 |
+
### Para cada nova versão (ex: 1.0.0):
|
| 124 |
+
|
| 125 |
+
```bash
|
| 126 |
+
# 1. Build local ✅ (já feito)
|
| 127 |
+
python build/release_uploader.py --version 1.0.0
|
| 128 |
+
|
| 129 |
+
# 2. Verificar arquivo
|
| 130 |
+
dir build\release\*.zip
|
| 131 |
+
|
| 132 |
+
# 3. Upload para HF Dataset
|
| 133 |
+
python scripts/upload_release_to_hf.py `
|
| 134 |
+
--repo-id your-org/birdnet-uploader-releases `
|
| 135 |
+
--version 1.0.0
|
| 136 |
+
|
| 137 |
+
# 4. Atualizar link no código
|
| 138 |
+
# Edite src/uploader/web_ui.py com novo link
|
| 139 |
+
|
| 140 |
+
# 5. Commit e push para repo
|
| 141 |
+
git add -A
|
| 142 |
+
git commit -m "Release v1.0.0: Windows portable"
|
| 143 |
+
git push
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
## Validação de Download
|
| 147 |
+
|
| 148 |
+
### Para usuários, validar integridade:
|
| 149 |
+
|
| 150 |
+
```powershell
|
| 151 |
+
# Após download
|
| 152 |
+
$expected = "hash-sha256-aqui"
|
| 153 |
+
$actual = (Get-FileHash -Path "birdnet-uploader-1.0.0-windows.zip" -Algorithm SHA256).Hash
|
| 154 |
+
if ($actual -eq $expected) {
|
| 155 |
+
Write-Host "✅ Arquivo verificado com sucesso"
|
| 156 |
+
} else {
|
| 157 |
+
Write-Host "❌ Checksum inválido!"
|
| 158 |
+
}
|
| 159 |
+
```
|
| 160 |
+
|
| 161 |
+
## Melhorias Futuras
|
| 162 |
+
|
| 163 |
+
1. **CDN**: Usar Cloudflare CDN para acelerar downloads
|
| 164 |
+
2. **Auto-update**: Implementar verificação de versão no app
|
| 165 |
+
3. **Code signing**: Assinar o .exe com certificado
|
| 166 |
+
4. **Mirror**: Hospedar em multiple plataformas (GitHub, SourceForge, etc)
|
| 167 |
+
|
| 168 |
+
## Recomendação Final
|
| 169 |
+
|
| 170 |
+
**Use a Opção 1 (Dataset HF)** porque:
|
| 171 |
+
- ✅ Hospedagem gratuita e ilimitada
|
| 172 |
+
- ✅ Download automático com HF CDN (rápido)
|
| 173 |
+
- ✅ Versionamento histórico
|
| 174 |
+
- ✅ Fácil integração com Space
|
| 175 |
+
- ✅ Sem dependência de GitHub
|
docs/RELEASE_PROCESS.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🚀 Release Process - BirdNET Uploader Windows Portable
|
| 2 |
+
|
| 3 |
+
Este documento descreve o fluxo completo para construir, testar e publicar a versão Windows portable do BirdNET Uploader.
|
| 4 |
+
|
| 5 |
+
## Visão Geral do Fluxo
|
| 6 |
+
|
| 7 |
+
```
|
| 8 |
+
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
|
| 9 |
+
│ 1. Build Local │ → │ 2. Upload HF │ → │ 3. Update App │
|
| 10 |
+
│ PyInstaller │ │ (Dataset) │ │ Links & Deploy │
|
| 11 |
+
└──────────────────┘ └──────────────────┘ └──────────────────┘
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
## Requisitos
|
| 15 |
+
|
| 16 |
+
- **Python 3.11+** com `pip` configurado
|
| 17 |
+
- **Hugging Face CLI**: `huggingface-cli` instalado
|
| 18 |
+
- **Token HF**: Com permissão `write` em dataset (obtenha em https://huggingface.co/settings/tokens)
|
| 19 |
+
- **Espaço em disco**: ~3 GB (para build + temp files)
|
| 20 |
+
- **Windows 10/11** para build do .exe (ou use CI/CD)
|
| 21 |
+
|
| 22 |
+
## Passo a Passo
|
| 23 |
+
|
| 24 |
+
### 1️⃣ Build Local do Executável
|
| 25 |
+
|
| 26 |
+
```powershell
|
| 27 |
+
# Navegar para o diretório do projeto
|
| 28 |
+
cd C:\Users\seu_usuario\Documents\Python\BirdNET-Uploader-App
|
| 29 |
+
|
| 30 |
+
# Instalar dependências de build
|
| 31 |
+
python -m pip install -q pyinstaller
|
| 32 |
+
|
| 33 |
+
# Executar o build (demora ~5-10 minutos)
|
| 34 |
+
python build/release_uploader.py --version 1.0.0
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
**Resultado:**
|
| 38 |
+
- Arquivo criado: `build/release/birdnet-uploader-1.0.0-windows.zip` (~100 MB)
|
| 39 |
+
- Arquivo criado: `build/release/birdnet-uploader-1.0.0-windows.zip.sha256`
|
| 40 |
+
|
| 41 |
+
### 2️⃣ Criar Dataset no Hugging Face (Primeira Vez)
|
| 42 |
+
|
| 43 |
+
Acesse https://huggingface.co/new-dataset e configure:
|
| 44 |
+
|
| 45 |
+
- **Repository name**: `birdnet-uploader-releases`
|
| 46 |
+
- **License**: `mit`
|
| 47 |
+
- **Private**: Deixe **desmarcado** (público)
|
| 48 |
+
|
| 49 |
+
### 3️⃣ Upload para Hugging Face
|
| 50 |
+
|
| 51 |
+
```powershell
|
| 52 |
+
# Definir variáveis de ambiente
|
| 53 |
+
$env:HF_TOKEN = "hf_xxxxxxxxxxxx" # Seu token HF
|
| 54 |
+
|
| 55 |
+
# Executar script de upload
|
| 56 |
+
.\scripts\upload_release.ps1 `
|
| 57 |
+
-Version 1.0.0 `
|
| 58 |
+
-RepoId "your-org/birdnet-uploader-releases"
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
Ou usar o script Python direto:
|
| 62 |
+
|
| 63 |
+
```powershell
|
| 64 |
+
python scripts/upload_release_to_hf.py `
|
| 65 |
+
--repo-id your-org/birdnet-uploader-releases `
|
| 66 |
+
--version 1.0.0 `
|
| 67 |
+
--token $env:HF_TOKEN
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
### 4️⃣ Atualizar Links na Aplicação Web
|
| 71 |
+
|
| 72 |
+
Após upload bem-sucedido, você receberá URLs como:
|
| 73 |
+
|
| 74 |
+
```
|
| 75 |
+
https://huggingface.co/datasets/your-org/birdnet-uploader-releases/resolve/main/releases/v1.0.0/birdnet-uploader-1.0.0-windows.zip
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
**Atualize** [src/uploader/web_ui.py](../src/uploader/web_ui.py):
|
| 79 |
+
|
| 80 |
+
```python
|
| 81 |
+
# Procure por "with gr.Group("Download")" e atualize a URL
|
| 82 |
+
new_url = "https://huggingface.co/datasets/your-org/birdnet-uploader-releases/resolve/main/releases/v1.0.0/birdnet-uploader-1.0.0-windows.zip"
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
### 5️⃣ Deploy no Hugging Face Spaces
|
| 86 |
+
|
| 87 |
+
Se você tem um Space com o app:
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
# Commit e push as alterações
|
| 91 |
+
git add src/uploader/web_ui.py
|
| 92 |
+
git commit -m "Release 1.0.0: Update Windows portable download link"
|
| 93 |
+
git push
|
| 94 |
+
|
| 95 |
+
# O Space será atualizado automaticamente (ou você pode forçar rebuild)
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
## Verificação Pré-Release
|
| 99 |
+
|
| 100 |
+
Antes de publicar, valide:
|
| 101 |
+
|
| 102 |
+
### ✅ Teste Local do Executável
|
| 103 |
+
|
| 104 |
+
```powershell
|
| 105 |
+
# Extrair o ZIP
|
| 106 |
+
Expand-Archive -Path "build/release/birdnet-uploader-1.0.0-windows.zip" `
|
| 107 |
+
-DestinationPath "temp_test"
|
| 108 |
+
|
| 109 |
+
# Testar interface web
|
| 110 |
+
cd temp_test/birdnet-uploader
|
| 111 |
+
.\birdnet-uploader.exe
|
| 112 |
+
|
| 113 |
+
# Abrir navegador em http://localhost:7860
|
| 114 |
+
# Testar login, upload de arquivo pequeno, etc.
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
### ✅ Validar Checksum
|
| 118 |
+
|
| 119 |
+
```powershell
|
| 120 |
+
# Verificar integridade do arquivo
|
| 121 |
+
$hash = Get-FileHash -Path "build/release/birdnet-uploader-1.0.0-windows.zip" -Algorithm SHA256
|
| 122 |
+
$hash.Hash # Compare com arquivo .sha256
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
### ✅ Testar Download do HF
|
| 126 |
+
|
| 127 |
+
```powershell
|
| 128 |
+
# Depois do upload, baixar e validar
|
| 129 |
+
$url = "https://huggingface.co/datasets/your-org/birdnet-uploader-releases/resolve/main/releases/v1.0.0/birdnet-uploader-1.0.0-windows.zip"
|
| 130 |
+
|
| 131 |
+
# Download manual via navegador ou curl
|
| 132 |
+
curl -L -o test_download.zip $url
|
| 133 |
+
|
| 134 |
+
# Validar tamanho e integridade
|
| 135 |
+
Get-Item test_download.zip | Format-List Length
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
## Estrutura do Dataset HF
|
| 139 |
+
|
| 140 |
+
Após upload, seu dataset terá esta estrutura:
|
| 141 |
+
|
| 142 |
+
```
|
| 143 |
+
birdnet-uploader-releases/
|
| 144 |
+
├── releases/
|
| 145 |
+
│ ├── v1.0.0/
|
| 146 |
+
│ │ ├── birdnet-uploader-1.0.0-windows.zip
|
| 147 |
+
│ │ └── birdnet-uploader-1.0.0-windows.zip.sha256
|
| 148 |
+
│ ├── v1.1.0/
|
| 149 |
+
│ │ ├── birdnet-uploader-1.1.0-windows.zip
|
| 150 |
+
│ │ └── birdnet-uploader-1.1.0-windows.zip.sha256
|
| 151 |
+
│ └── README.md (opcional)
|
| 152 |
+
└── ...
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
## Automação com GitHub Actions
|
| 156 |
+
|
| 157 |
+
Para automatizar o build e upload (futuro):
|
| 158 |
+
|
| 159 |
+
```yaml
|
| 160 |
+
# .github/workflows/release.yml
|
| 161 |
+
name: Build and Release Windows Portable
|
| 162 |
+
|
| 163 |
+
on:
|
| 164 |
+
push:
|
| 165 |
+
tags:
|
| 166 |
+
- 'v*.*.*'
|
| 167 |
+
|
| 168 |
+
jobs:
|
| 169 |
+
build-and-upload:
|
| 170 |
+
runs-on: windows-latest
|
| 171 |
+
|
| 172 |
+
steps:
|
| 173 |
+
- uses: actions/checkout@v4
|
| 174 |
+
|
| 175 |
+
- uses: actions/setup-python@v4
|
| 176 |
+
with:
|
| 177 |
+
python-version: '3.11'
|
| 178 |
+
|
| 179 |
+
- name: Install dependencies
|
| 180 |
+
run: |
|
| 181 |
+
python -m pip install -r requirements.txt
|
| 182 |
+
python -m pip install pyinstaller
|
| 183 |
+
|
| 184 |
+
- name: Build Windows executable
|
| 185 |
+
run: python build/release_uploader.py --version ${{ github.ref_name }}
|
| 186 |
+
|
| 187 |
+
- name: Upload to Hugging Face
|
| 188 |
+
env:
|
| 189 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 190 |
+
run: |
|
| 191 |
+
python scripts/upload_release_to_hf.py `
|
| 192 |
+
--repo-id jrrribeiro/birdnet-uploader-releases `
|
| 193 |
+
--version ${{ github.ref_name }}
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
## Troubleshooting
|
| 197 |
+
|
| 198 |
+
### Erro: "File not found" durante build
|
| 199 |
+
|
| 200 |
+
```
|
| 201 |
+
Release file not found: build/release/birdnet-uploader-1.0.0-windows.zip
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
**Solução**: Execute `python build/release_uploader.py --version 1.0.0` primeiro.
|
| 205 |
+
|
| 206 |
+
### Erro: "Authentication failed" durante upload
|
| 207 |
+
|
| 208 |
+
```
|
| 209 |
+
HfApi.upload_file(): Invalid token or insufficient permissions
|
| 210 |
+
```
|
| 211 |
+
|
| 212 |
+
**Solução**:
|
| 213 |
+
1. Gere novo token em https://huggingface.co/settings/tokens
|
| 214 |
+
2. Certifique-se de ter permissão `write`
|
| 215 |
+
3. Execute `huggingface-cli login` novamente
|
| 216 |
+
|
| 217 |
+
### Executável não abre após download
|
| 218 |
+
|
| 219 |
+
**Solução**:
|
| 220 |
+
1. Desative Windows Defender temporariamente (é falso positivo)
|
| 221 |
+
2. Ou execute: `powershell -Command "Unblock-File -Path 'birdnet-uploader.exe'"`
|
| 222 |
+
|
| 223 |
+
### Arquivo ZIP muito grande (>200 MB)
|
| 224 |
+
|
| 225 |
+
**Causa**: Dependências desnecessárias incluídas
|
| 226 |
+
|
| 227 |
+
**Solução**: Atualize `build/pyinstaller_uploader.spec` para excluir módulos desnecessários:
|
| 228 |
+
|
| 229 |
+
```python
|
| 230 |
+
# No spec file, adicione em excludes:
|
| 231 |
+
excludes=['PIL', 'scipy', 'sklearn', 'torch', ...]
|
| 232 |
+
```
|
| 233 |
+
|
| 234 |
+
## Documentação para Usuários
|
| 235 |
+
|
| 236 |
+
Após publicar, compartilhe o [WINDOWS_PORTABLE_SETUP.md](./WINDOWS_PORTABLE_SETUP.md) com instruções de instalação.
|
| 237 |
+
|
| 238 |
+
## Checklist de Release
|
| 239 |
+
|
| 240 |
+
- [ ] Build local completado sem erros
|
| 241 |
+
- [ ] Teste do executável realizado
|
| 242 |
+
- [ ] Checksum verificado
|
| 243 |
+
- [ ] Dataset criado no HF (primeira vez)
|
| 244 |
+
- [ ] Upload concluído com sucesso
|
| 245 |
+
- [ ] Links atualizados em `src/uploader/web_ui.py`
|
| 246 |
+
- [ ] Changes commitadas e pushed
|
| 247 |
+
- [ ] Space/App atualizado
|
| 248 |
+
- [ ] Documentação atualizada
|
| 249 |
+
- [ ] Versão marcada no Git (git tag v1.0.0)
|
| 250 |
+
|
| 251 |
+
## Versioning
|
| 252 |
+
|
| 253 |
+
Use **Semantic Versioning**:
|
| 254 |
+
- **Major.Minor.Patch** (ex: 1.0.0, 1.1.0, 1.1.1)
|
| 255 |
+
- Major: Mudanças incompatíveis
|
| 256 |
+
- Minor: Novo recurso compatível
|
| 257 |
+
- Patch: Bugfix compatível
|
| 258 |
+
|
| 259 |
+
## Suporte
|
| 260 |
+
|
| 261 |
+
Dúvidas? Abra uma issue em: https://github.com/jrrribeiro/BirdNET-Uploader-App/issues
|
scripts/upload_release.ps1
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Upload Windows Portable to Hugging Face
|
| 2 |
+
# Usage: .\scripts\upload_release.ps1 -Version 1.0.0 -RepoId "your-org/birdnet-uploader-releases"
|
| 3 |
+
|
| 4 |
+
param(
|
| 5 |
+
[Parameter(Mandatory = $true)]
|
| 6 |
+
[string]$Version,
|
| 7 |
+
|
| 8 |
+
[Parameter(Mandatory = $true)]
|
| 9 |
+
[string]$RepoId,
|
| 10 |
+
|
| 11 |
+
[string]$Token = $env:HF_TOKEN
|
| 12 |
+
)
|
| 13 |
+
|
| 14 |
+
$ErrorActionPreference = "Stop"
|
| 15 |
+
|
| 16 |
+
$ProjectRoot = Split-Path -Parent $PSScriptRoot
|
| 17 |
+
$ReleasesDir = Join-Path $ProjectRoot "build" "release"
|
| 18 |
+
$ZipFile = Join-Path $ReleasesDir "birdnet-uploader-$Version-windows.zip"
|
| 19 |
+
$Sha256File = "$ZipFile.sha256"
|
| 20 |
+
|
| 21 |
+
Write-Host "🚀 BirdNET Uploader Release Upload" -ForegroundColor Cyan
|
| 22 |
+
Write-Host "=====================================`n"
|
| 23 |
+
|
| 24 |
+
# Validation
|
| 25 |
+
if (-not (Test-Path $ZipFile)) {
|
| 26 |
+
throw "Release file not found: $ZipFile"
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
if (-not $Token) {
|
| 30 |
+
Write-Host "⚠️ HF_TOKEN environment variable not set." -ForegroundColor Yellow
|
| 31 |
+
Write-Host "Set it with: `$env:HF_TOKEN = 'hf_xxxxxxxxxxxx'" -ForegroundColor Yellow
|
| 32 |
+
Write-Host "Get your token at: https://huggingface.co/settings/tokens`n" -ForegroundColor Yellow
|
| 33 |
+
exit 1
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
# File info
|
| 37 |
+
$ZipSize = (Get-Item $ZipFile).Length / 1GB
|
| 38 |
+
Write-Host "📦 Release Information"
|
| 39 |
+
Write-Host " Version: $Version"
|
| 40 |
+
Write-Host " File: $(Split-Path -Leaf $ZipFile)"
|
| 41 |
+
Write-Host " Size: $([math]::Round($ZipSize, 2)) GB"
|
| 42 |
+
Write-Host " Repo: $RepoId`n"
|
| 43 |
+
|
| 44 |
+
# Install huggingface_hub if needed
|
| 45 |
+
Write-Host "📥 Checking dependencies..."
|
| 46 |
+
try {
|
| 47 |
+
python -m pip show huggingface_hub > $null 2>&1
|
| 48 |
+
if ($LASTEXITCODE -ne 0) {
|
| 49 |
+
throw "Not installed"
|
| 50 |
+
}
|
| 51 |
+
} catch {
|
| 52 |
+
Write-Host "Installing huggingface_hub..." -ForegroundColor Cyan
|
| 53 |
+
python -m pip install -q huggingface_hub
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
# Upload
|
| 57 |
+
Write-Host "🔐 Authenticating with Hugging Face..." -ForegroundColor Cyan
|
| 58 |
+
$PythonScript = @"
|
| 59 |
+
import os
|
| 60 |
+
import sys
|
| 61 |
+
from huggingface_hub import HfApi
|
| 62 |
+
from pathlib import Path
|
| 63 |
+
import hashlib
|
| 64 |
+
|
| 65 |
+
def upload_release():
|
| 66 |
+
token = r'$Token'
|
| 67 |
+
repo_id = r'$RepoId'
|
| 68 |
+
version = r'$Version'
|
| 69 |
+
zip_path = Path(r'$ZipFile')
|
| 70 |
+
|
| 71 |
+
# Verify file exists
|
| 72 |
+
if not zip_path.exists():
|
| 73 |
+
print(f"❌ File not found: {zip_path}")
|
| 74 |
+
sys.exit(1)
|
| 75 |
+
|
| 76 |
+
# Initialize API
|
| 77 |
+
api = HfApi(token=token)
|
| 78 |
+
|
| 79 |
+
# Compute checksum
|
| 80 |
+
print("🔢 Computing SHA256 checksum...")
|
| 81 |
+
sha256_hash = hashlib.sha256()
|
| 82 |
+
with open(zip_path, "rb") as f:
|
| 83 |
+
for byte_block in iter(lambda: f.read(4096), b""):
|
| 84 |
+
sha256_hash.update(byte_block)
|
| 85 |
+
checksum = sha256_hash.hexdigest()
|
| 86 |
+
print(f" SHA256: {checksum}")
|
| 87 |
+
|
| 88 |
+
# Remote paths
|
| 89 |
+
remote_base = f"releases/v{version}"
|
| 90 |
+
remote_zip = f"{remote_base}/{zip_path.name}"
|
| 91 |
+
remote_sha256 = f"{remote_base}/{zip_path.name}.sha256"
|
| 92 |
+
|
| 93 |
+
try:
|
| 94 |
+
# Upload ZIP
|
| 95 |
+
print(f"\n📤 Uploading ZIP to {repo_id}/{remote_zip}...")
|
| 96 |
+
api.upload_file(
|
| 97 |
+
path_or_fileobj=str(zip_path),
|
| 98 |
+
path_in_repo=remote_zip,
|
| 99 |
+
repo_id=repo_id,
|
| 100 |
+
repo_type="dataset",
|
| 101 |
+
commit_message=f"Release {version} - Windows portable executable",
|
| 102 |
+
)
|
| 103 |
+
print(" ✅ ZIP uploaded successfully")
|
| 104 |
+
|
| 105 |
+
# Upload SHA256
|
| 106 |
+
print(f"\n📤 Uploading checksum to {repo_id}/{remote_sha256}...")
|
| 107 |
+
checksum_content = f"{checksum} {zip_path.name}\n"
|
| 108 |
+
api.upload_file(
|
| 109 |
+
path_or_fileobj=checksum_content.encode(),
|
| 110 |
+
path_in_repo=remote_sha256,
|
| 111 |
+
repo_id=repo_id,
|
| 112 |
+
repo_type="dataset",
|
| 113 |
+
commit_message=f"Release {version} - Checksum",
|
| 114 |
+
)
|
| 115 |
+
print(" ✅ Checksum uploaded successfully")
|
| 116 |
+
|
| 117 |
+
# Print results
|
| 118 |
+
print(f"\n✨ Release uploaded successfully!\n")
|
| 119 |
+
print(f"📥 Download URLs:")
|
| 120 |
+
print(f" ZIP: https://huggingface.co/datasets/{repo_id}/resolve/main/{remote_zip}")
|
| 121 |
+
print(f" SHA256: https://huggingface.co/datasets/{repo_id}/resolve/main/{remote_sha256}")
|
| 122 |
+
print(f"\n💡 Update web UI link with:")
|
| 123 |
+
print(f" https://huggingface.co/datasets/{repo_id}/resolve/main/{remote_zip}")
|
| 124 |
+
|
| 125 |
+
except Exception as e:
|
| 126 |
+
print(f"❌ Upload failed: {e}")
|
| 127 |
+
sys.exit(1)
|
| 128 |
+
|
| 129 |
+
upload_release()
|
| 130 |
+
"@
|
| 131 |
+
|
| 132 |
+
# Execute upload
|
| 133 |
+
python -c $PythonScript
|
| 134 |
+
if ($LASTEXITCODE -ne 0) {
|
| 135 |
+
Write-Host "❌ Upload failed" -ForegroundColor Red
|
| 136 |
+
exit 1
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
Write-Host "`n✅ Done! Release is now available for download." -ForegroundColor Green
|
scripts/upload_release_to_hf.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Upload Windows portable release to Hugging Face Dataset.
|
| 4 |
+
|
| 5 |
+
Usage:
|
| 6 |
+
python scripts/upload_release_to_hf.py \
|
| 7 |
+
--repo-id jrrribeiro/birdnet-uploader-releases \
|
| 8 |
+
--version 1.0.0
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
import hashlib
|
| 13 |
+
import os
|
| 14 |
+
from pathlib import Path
|
| 15 |
+
from huggingface_hub import HfApi
|
| 16 |
+
|
| 17 |
+
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
| 18 |
+
RELEASE_DIR = PROJECT_ROOT / "build" / "release"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def compute_sha256(file_path: Path) -> str:
|
| 22 |
+
"""Compute SHA256 checksum of a file."""
|
| 23 |
+
sha256_hash = hashlib.sha256()
|
| 24 |
+
with open(file_path, "rb") as f:
|
| 25 |
+
for byte_block in iter(lambda: f.read(4096), b""):
|
| 26 |
+
sha256_hash.update(byte_block)
|
| 27 |
+
return sha256_hash.hexdigest()
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def upload_release(repo_id: str, version: str, token: str = None) -> None:
|
| 31 |
+
"""Upload release files to Hugging Face."""
|
| 32 |
+
|
| 33 |
+
api = HfApi(token=token) if token else HfApi()
|
| 34 |
+
|
| 35 |
+
# Find the release files
|
| 36 |
+
zip_file = RELEASE_DIR / f"birdnet-uploader-{version}-windows.zip"
|
| 37 |
+
|
| 38 |
+
if not zip_file.exists():
|
| 39 |
+
raise FileNotFoundError(f"Release file not found: {zip_file}")
|
| 40 |
+
|
| 41 |
+
print(f"📦 Uploading: {zip_file.name}")
|
| 42 |
+
print(f" Size: {zip_file.stat().st_size / (1024**3):.2f} GB")
|
| 43 |
+
|
| 44 |
+
# Compute checksum
|
| 45 |
+
checksum = compute_sha256(zip_file)
|
| 46 |
+
print(f" SHA256: {checksum}")
|
| 47 |
+
|
| 48 |
+
# Create remote path: releases/v{version}/
|
| 49 |
+
remote_base = f"releases/v{version}"
|
| 50 |
+
remote_zip_path = f"{remote_base}/{zip_file.name}"
|
| 51 |
+
remote_checksum_path = f"{remote_base}/{zip_file.name}.sha256"
|
| 52 |
+
|
| 53 |
+
try:
|
| 54 |
+
# Upload zip file
|
| 55 |
+
print(f"\n📤 Uploading to {repo_id}/{remote_zip_path}...")
|
| 56 |
+
api.upload_file(
|
| 57 |
+
path_or_fileobj=str(zip_file),
|
| 58 |
+
path_in_repo=remote_zip_path,
|
| 59 |
+
repo_id=repo_id,
|
| 60 |
+
repo_type="dataset",
|
| 61 |
+
commit_message=f"Release {version} - Windows portable",
|
| 62 |
+
)
|
| 63 |
+
print("✅ ZIP uploaded successfully")
|
| 64 |
+
|
| 65 |
+
# Upload checksum file
|
| 66 |
+
print(f"\n📤 Uploading checksum to {repo_id}/{remote_checksum_path}...")
|
| 67 |
+
checksum_content = f"{checksum} {zip_file.name}\n"
|
| 68 |
+
api.upload_file(
|
| 69 |
+
path_or_fileobj=checksum_content.encode(),
|
| 70 |
+
path_in_repo=remote_checksum_path,
|
| 71 |
+
repo_id=repo_id,
|
| 72 |
+
repo_type="dataset",
|
| 73 |
+
commit_message=f"Release {version} - Checksum",
|
| 74 |
+
)
|
| 75 |
+
print("✅ Checksum uploaded successfully")
|
| 76 |
+
|
| 77 |
+
# Print download URLs
|
| 78 |
+
print(f"\n🎉 Release uploaded successfully!")
|
| 79 |
+
print(f"\n📥 Download URLs:")
|
| 80 |
+
print(f" ZIP: https://huggingface.co/datasets/{repo_id}/resolve/main/{remote_zip_path}")
|
| 81 |
+
print(f" SHA256: https://huggingface.co/datasets/{repo_id}/resolve/main/{remote_checksum_path}")
|
| 82 |
+
|
| 83 |
+
except Exception as e:
|
| 84 |
+
print(f"❌ Upload failed: {e}")
|
| 85 |
+
raise
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def main():
|
| 89 |
+
parser = argparse.ArgumentParser(
|
| 90 |
+
description="Upload Windows portable release to Hugging Face"
|
| 91 |
+
)
|
| 92 |
+
parser.add_argument(
|
| 93 |
+
"--repo-id",
|
| 94 |
+
required=True,
|
| 95 |
+
help="Hugging Face dataset repo ID (format: owner/dataset-name)",
|
| 96 |
+
)
|
| 97 |
+
parser.add_argument(
|
| 98 |
+
"--version",
|
| 99 |
+
required=True,
|
| 100 |
+
help="Release version (e.g., 1.0.0)",
|
| 101 |
+
)
|
| 102 |
+
parser.add_argument(
|
| 103 |
+
"--token",
|
| 104 |
+
default=os.getenv("HF_TOKEN"),
|
| 105 |
+
help="Hugging Face API token (can also set HF_TOKEN env var)",
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
args = parser.parse_args()
|
| 109 |
+
|
| 110 |
+
if not args.token:
|
| 111 |
+
print("⚠️ HF_TOKEN not found. Using public access.")
|
| 112 |
+
print(" To upload, set HF_TOKEN environment variable.")
|
| 113 |
+
print(" Get your token from: https://huggingface.co/settings/tokens")
|
| 114 |
+
|
| 115 |
+
upload_release(args.repo_id, args.version, args.token)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
if __name__ == "__main__":
|
| 119 |
+
main()
|
src/uploader/web_ui.py
CHANGED
|
@@ -2,7 +2,9 @@ from __future__ import annotations
|
|
| 2 |
|
| 3 |
import os
|
| 4 |
import shutil
|
|
|
|
| 5 |
import tempfile
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
from typing import List
|
| 8 |
|
|
@@ -17,6 +19,7 @@ from .deduplicator import Deduplicator
|
|
| 17 |
from .batch_uploader import BatchUploader
|
| 18 |
from .manifest import build_manifest_from_scan, manifest_to_bytes, write_shards_from_csv_rows
|
| 19 |
from .session_manager import SessionManager
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
def _store_uploaded_files(files: List, dst: Path) -> None:
|
|
@@ -47,7 +50,33 @@ def _store_uploaded_files(files: List, dst: Path) -> None:
|
|
| 47 |
continue
|
| 48 |
|
| 49 |
|
| 50 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
# Basic validation
|
| 52 |
if not token or not repo_id:
|
| 53 |
return "Error: token and repo_id are required." , None
|
|
@@ -55,8 +84,47 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 55 |
# Store uploaded files to a temp directory
|
| 56 |
tmpdir = Path(tempfile.mkdtemp(prefix="birdnet-upload-"))
|
| 57 |
try:
|
|
|
|
| 58 |
_store_uploaded_files(files or [], tmpdir)
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
csv_path = None
|
| 61 |
if csv_file:
|
| 62 |
csv_tmp = tmpdir / Path(csv_file.name).name if hasattr(csv_file, "name") else tmpdir / "detections.csv"
|
|
@@ -80,6 +148,7 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 80 |
# Validate repo / create if necessary
|
| 81 |
api = HfApi(token=token)
|
| 82 |
repo_service = RepositoryService(token)
|
|
|
|
| 83 |
validation = repo_service.validate_repo(repo_id)
|
| 84 |
if not validation.get("is_valid"):
|
| 85 |
# attempt to create required structure
|
|
@@ -89,14 +158,19 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 89 |
# fall back to warning
|
| 90 |
pass
|
| 91 |
|
| 92 |
-
# Build scan summary from
|
|
|
|
| 93 |
scanner = LocalScanner()
|
| 94 |
-
#
|
| 95 |
-
summary = scanner.scan_folder(str(
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
# Upload CSV if present
|
| 98 |
try:
|
| 99 |
if csv_path:
|
|
|
|
| 100 |
api.upload_file(path_or_file=str(csv_path), path_in_repo="index/detections.csv", repo_id=repo_id, repo_type="dataset")
|
| 101 |
except Exception as exc:
|
| 102 |
return f"CSV upload failed: {exc}", None
|
|
@@ -111,7 +185,9 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 111 |
reader = csv.DictReader(fh)
|
| 112 |
csv_rows = list(reader)
|
| 113 |
|
|
|
|
| 114 |
manifest = build_manifest_from_scan(repo_id, summary, csv_rows=csv_rows)
|
|
|
|
| 115 |
api.upload_file(path_or_fileobj=manifest_to_bytes(manifest), path_in_repo="index/manifest.json", repo_id=repo_id, repo_type="dataset")
|
| 116 |
except Exception as exc:
|
| 117 |
return f"Manifest upload failed: {exc}", None
|
|
@@ -119,9 +195,11 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 119 |
# Generate and upload shards if CSV provided
|
| 120 |
try:
|
| 121 |
if csv_path and csv_rows:
|
|
|
|
| 122 |
shards = write_shards_from_csv_rows(csv_rows)
|
| 123 |
-
for shard_path in shards:
|
| 124 |
try:
|
|
|
|
| 125 |
api.upload_file(path_or_file=str(shard_path), path_in_repo=f"index/shards/{shard_path.name}", repo_id=repo_id, repo_type="dataset")
|
| 126 |
except Exception:
|
| 127 |
# continue with other shards
|
|
@@ -130,6 +208,7 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 130 |
pass
|
| 131 |
|
| 132 |
# Dedup + batch upload
|
|
|
|
| 133 |
dedup = Deduplicator(api=api, repo_id=repo_id)
|
| 134 |
session = SessionManager()
|
| 135 |
uploader = BatchUploader(api=api, repo_id=repo_id, deduplicator=dedup, session=session, max_workers=workers)
|
|
@@ -140,12 +219,25 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 140 |
for it in items:
|
| 141 |
file_infos.append({"full_path": it["full_path"], "relative_path": it["relative_path"], "size": it.get("size", 0)})
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
finally:
|
| 150 |
# cleanup tempdir
|
| 151 |
try:
|
|
@@ -171,8 +263,12 @@ def create_uploader_app():
|
|
| 171 |
remote_base = gr.Textbox(label="Remote base path (default: audio)", value="audio")
|
| 172 |
|
| 173 |
with gr.Group("Files"):
|
| 174 |
-
files = gr.File(
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
with gr.Row():
|
| 178 |
workers = gr.Number(label="Parallel workers (for large uploads)", value=4)
|
|
@@ -182,10 +278,26 @@ def create_uploader_app():
|
|
| 182 |
status = gr.Textbox(label="Status", interactive=False)
|
| 183 |
|
| 184 |
with gr.Group("Download"):
|
| 185 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
-
def _start(token_val, repo_val, files_val, csv_val, remote_base_val, workers_val):
|
| 188 |
-
status_text, result = _handle_upload(token_val, repo_val, files_val, csv_val, remote_base_val, int(workers_val) if workers_val else None)
|
| 189 |
return status_text
|
| 190 |
|
| 191 |
upload_btn.click(_start, inputs=[token, repo_id, files, csv_file, remote_base, workers], outputs=[status])
|
|
|
|
| 2 |
|
| 3 |
import os
|
| 4 |
import shutil
|
| 5 |
+
import tarfile
|
| 6 |
import tempfile
|
| 7 |
+
import zipfile
|
| 8 |
from pathlib import Path
|
| 9 |
from typing import List
|
| 10 |
|
|
|
|
| 19 |
from .batch_uploader import BatchUploader
|
| 20 |
from .manifest import build_manifest_from_scan, manifest_to_bytes, write_shards_from_csv_rows
|
| 21 |
from .session_manager import SessionManager
|
| 22 |
+
from .config import WEB_UI_MAX_SIZE_BYTES
|
| 23 |
|
| 24 |
|
| 25 |
def _store_uploaded_files(files: List, dst: Path) -> None:
|
|
|
|
| 50 |
continue
|
| 51 |
|
| 52 |
|
| 53 |
+
def _extract_archive(archive_path: Path, extract_to: Path) -> bool:
|
| 54 |
+
"""Extract tar, tar.gz, or zip archives. Returns True if extraction succeeded."""
|
| 55 |
+
try:
|
| 56 |
+
if archive_path.suffix.lower() == ".zip":
|
| 57 |
+
with zipfile.ZipFile(archive_path, "r") as zf:
|
| 58 |
+
zf.extractall(extract_to)
|
| 59 |
+
return True
|
| 60 |
+
elif archive_path.suffix.lower() == ".gz":
|
| 61 |
+
# Handle .tar.gz
|
| 62 |
+
if archive_path.stem.endswith(".tar"):
|
| 63 |
+
with tarfile.open(archive_path, "r:gz") as tf:
|
| 64 |
+
tf.extractall(extract_to)
|
| 65 |
+
return True
|
| 66 |
+
else:
|
| 67 |
+
return False
|
| 68 |
+
elif archive_path.suffix.lower() == ".tar":
|
| 69 |
+
with tarfile.open(archive_path, "r") as tf:
|
| 70 |
+
tf.extractall(extract_to)
|
| 71 |
+
return True
|
| 72 |
+
else:
|
| 73 |
+
return False
|
| 74 |
+
except Exception as exc:
|
| 75 |
+
print(f"Archive extraction error: {exc}")
|
| 76 |
+
return False
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str, workers: int | None, progress=gr.Progress()):
|
| 80 |
# Basic validation
|
| 81 |
if not token or not repo_id:
|
| 82 |
return "Error: token and repo_id are required." , None
|
|
|
|
| 84 |
# Store uploaded files to a temp directory
|
| 85 |
tmpdir = Path(tempfile.mkdtemp(prefix="birdnet-upload-"))
|
| 86 |
try:
|
| 87 |
+
progress(0, desc="Initializing upload...")
|
| 88 |
_store_uploaded_files(files or [], tmpdir)
|
| 89 |
|
| 90 |
+
# Handle archive extraction: look for .tar, .tar.gz, .zip files
|
| 91 |
+
audio_dir = tmpdir / "audio"
|
| 92 |
+
audio_dir.mkdir(parents=True, exist_ok=True)
|
| 93 |
+
|
| 94 |
+
for uploaded_file in tmpdir.iterdir():
|
| 95 |
+
if uploaded_file.is_file():
|
| 96 |
+
suffix = uploaded_file.suffix.lower()
|
| 97 |
+
# Check for .tar.gz before .gz
|
| 98 |
+
if uploaded_file.name.endswith(".tar.gz"):
|
| 99 |
+
progress(0.1, desc=f"Extracting {uploaded_file.name}...")
|
| 100 |
+
if _extract_archive(uploaded_file, audio_dir):
|
| 101 |
+
uploaded_file.unlink() # Delete archive after extraction
|
| 102 |
+
else:
|
| 103 |
+
return f"Failed to extract {uploaded_file.name}", None
|
| 104 |
+
elif suffix in {".tar", ".gz", ".zip"}:
|
| 105 |
+
progress(0.1, desc=f"Extracting {uploaded_file.name}...")
|
| 106 |
+
if _extract_archive(uploaded_file, audio_dir):
|
| 107 |
+
uploaded_file.unlink() # Delete archive after extraction
|
| 108 |
+
else:
|
| 109 |
+
return f"Failed to extract {uploaded_file.name}", None
|
| 110 |
+
elif suffix == ".csv":
|
| 111 |
+
# Keep CSV files as-is; handle them separately
|
| 112 |
+
pass
|
| 113 |
+
else:
|
| 114 |
+
# Assume non-archive, non-CSV files are audio files
|
| 115 |
+
shutil.move(str(uploaded_file), str(audio_dir / uploaded_file.name))
|
| 116 |
+
|
| 117 |
+
# Validate total size for web UI (1GB limit)
|
| 118 |
+
total_size = sum(f.stat().st_size for f in audio_dir.rglob("*") if f.is_file())
|
| 119 |
+
if total_size > WEB_UI_MAX_SIZE_BYTES:
|
| 120 |
+
size_gb = total_size / (1024**3)
|
| 121 |
+
return (
|
| 122 |
+
f"Upload exceeds 1 GB limit ({size_gb:.2f} GB). "
|
| 123 |
+
"Please download the Windows standalone uploader for large archives: "
|
| 124 |
+
"https://github.com/jrrribeiro/BirdNET-Uploader-App/releases/latest/download/birdnet-uploader-windows.zip",
|
| 125 |
+
None
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
csv_path = None
|
| 129 |
if csv_file:
|
| 130 |
csv_tmp = tmpdir / Path(csv_file.name).name if hasattr(csv_file, "name") else tmpdir / "detections.csv"
|
|
|
|
| 148 |
# Validate repo / create if necessary
|
| 149 |
api = HfApi(token=token)
|
| 150 |
repo_service = RepositoryService(token)
|
| 151 |
+
progress(0.2, desc="Validating repository...")
|
| 152 |
validation = repo_service.validate_repo(repo_id)
|
| 153 |
if not validation.get("is_valid"):
|
| 154 |
# attempt to create required structure
|
|
|
|
| 158 |
# fall back to warning
|
| 159 |
pass
|
| 160 |
|
| 161 |
+
# Build scan summary from extracted/uploaded files
|
| 162 |
+
progress(0.3, desc="Scanning files...")
|
| 163 |
scanner = LocalScanner()
|
| 164 |
+
# Scan the audio_dir where all files are now consolidated
|
| 165 |
+
summary = scanner.scan_folder(str(audio_dir))
|
| 166 |
+
|
| 167 |
+
total_files = summary.get("total_files", 0)
|
| 168 |
+
progress(0.4, desc=f"Found {total_files} audio files. Processing metadata...")
|
| 169 |
|
| 170 |
# Upload CSV if present
|
| 171 |
try:
|
| 172 |
if csv_path:
|
| 173 |
+
progress(0.45, desc="Uploading detections CSV...")
|
| 174 |
api.upload_file(path_or_file=str(csv_path), path_in_repo="index/detections.csv", repo_id=repo_id, repo_type="dataset")
|
| 175 |
except Exception as exc:
|
| 176 |
return f"CSV upload failed: {exc}", None
|
|
|
|
| 185 |
reader = csv.DictReader(fh)
|
| 186 |
csv_rows = list(reader)
|
| 187 |
|
| 188 |
+
progress(0.5, desc="Building manifest...")
|
| 189 |
manifest = build_manifest_from_scan(repo_id, summary, csv_rows=csv_rows)
|
| 190 |
+
progress(0.55, desc="Uploading manifest...")
|
| 191 |
api.upload_file(path_or_fileobj=manifest_to_bytes(manifest), path_in_repo="index/manifest.json", repo_id=repo_id, repo_type="dataset")
|
| 192 |
except Exception as exc:
|
| 193 |
return f"Manifest upload failed: {exc}", None
|
|
|
|
| 195 |
# Generate and upload shards if CSV provided
|
| 196 |
try:
|
| 197 |
if csv_path and csv_rows:
|
| 198 |
+
progress(0.6, desc="Generating shards...")
|
| 199 |
shards = write_shards_from_csv_rows(csv_rows)
|
| 200 |
+
for i, shard_path in enumerate(shards):
|
| 201 |
try:
|
| 202 |
+
progress(0.6 + (0.1 * i / len(shards)), desc=f"Uploading shard {i+1}/{len(shards)}...")
|
| 203 |
api.upload_file(path_or_file=str(shard_path), path_in_repo=f"index/shards/{shard_path.name}", repo_id=repo_id, repo_type="dataset")
|
| 204 |
except Exception:
|
| 205 |
# continue with other shards
|
|
|
|
| 208 |
pass
|
| 209 |
|
| 210 |
# Dedup + batch upload
|
| 211 |
+
progress(0.7, desc="Preparing uploads...")
|
| 212 |
dedup = Deduplicator(api=api, repo_id=repo_id)
|
| 213 |
session = SessionManager()
|
| 214 |
uploader = BatchUploader(api=api, repo_id=repo_id, deduplicator=dedup, session=session, max_workers=workers)
|
|
|
|
| 219 |
for it in items:
|
| 220 |
file_infos.append({"full_path": it["full_path"], "relative_path": it["relative_path"], "size": it.get("size", 0)})
|
| 221 |
|
| 222 |
+
uploaded_count = [0] # Use list to allow mutation in nested function
|
| 223 |
+
|
| 224 |
+
def on_progress_update(state: dict):
|
| 225 |
+
uploaded = state.get("uploaded", 0)
|
| 226 |
+
skipped = state.get("skipped", 0)
|
| 227 |
+
failed = state.get("failed", 0)
|
| 228 |
+
total = len(file_infos)
|
| 229 |
+
progress(0.7 + (0.25 * uploaded / max(total, 1)), desc=f"Uploading: {uploaded}/{total} files")
|
| 230 |
+
|
| 231 |
+
progress(0.7, desc="Starting file uploads...")
|
| 232 |
+
result = uploader.upload_files(file_infos, remote_base=remote_base or "audio", on_progress=on_progress_update)
|
| 233 |
+
progress(0.95, desc="Finalizing...")
|
| 234 |
+
|
| 235 |
+
uploaded = result.get("uploaded", 0)
|
| 236 |
+
skipped = result.get("skipped", 0)
|
| 237 |
+
failed = result.get("failed", 0)
|
| 238 |
+
status_msg = f"Upload finished! Uploaded: {uploaded}, Skipped: {skipped}, Failed: {failed}"
|
| 239 |
+
progress(1.0, desc="Complete")
|
| 240 |
+
return status_msg, result
|
| 241 |
finally:
|
| 242 |
# cleanup tempdir
|
| 243 |
try:
|
|
|
|
| 263 |
remote_base = gr.Textbox(label="Remote base path (default: audio)", value="audio")
|
| 264 |
|
| 265 |
with gr.Group("Files"):
|
| 266 |
+
files = gr.File(
|
| 267 |
+
label="Audio files or archive (.tar/.tar.gz/.zip) with optional CSV",
|
| 268 |
+
file_count="multiple",
|
| 269 |
+
file_types=[".wav", ".mp3", ".flac", ".ogg", ".m4a", ".tar", ".tar.gz", ".zip"]
|
| 270 |
+
)
|
| 271 |
+
csv_file = gr.File(label="Optional detections CSV (or include in archive)", file_count="single", file_types=[".csv"])
|
| 272 |
|
| 273 |
with gr.Row():
|
| 274 |
workers = gr.Number(label="Parallel workers (for large uploads)", value=4)
|
|
|
|
| 278 |
status = gr.Textbox(label="Status", interactive=False)
|
| 279 |
|
| 280 |
with gr.Group("Download"):
|
| 281 |
+
gr.Markdown("""
|
| 282 |
+
## 💾 Windows Portable Download
|
| 283 |
+
|
| 284 |
+
Para uploads maiores (>1 GB) ou melhor performance, baixe o executável portátil:
|
| 285 |
+
|
| 286 |
+
**[🔗 Download birdnet-uploader-1.0.0-windows.zip](https://huggingface.co/datasets/jrrribeiro/birdnet-uploader-releases/resolve/main/releases/v1.0.0/birdnet-uploader-1.0.0-windows.zip)**
|
| 287 |
+
|
| 288 |
+
- **Tamanho**: ~100 MB (sem Python necessário)
|
| 289 |
+
- **Performance**: Upload ilimitado via CLI
|
| 290 |
+
- **Segurança**: Checksum disponível [aqui](https://huggingface.co/datasets/jrrribeiro/birdnet-uploader-releases/resolve/main/releases/v1.0.0/birdnet-uploader-1.0.0-windows.zip.sha256)
|
| 291 |
+
- **Instruções**: [Setup Guide](https://github.com/jrrribeiro/BirdNET-Uploader-App/blob/main/WINDOWS_PORTABLE_SETUP.md)
|
| 292 |
+
|
| 293 |
+
### 📋 Checksum SHA256
|
| 294 |
+
```
|
| 295 |
+
fb022851524b6c7cf05c2f403118ae833f77656643f01fffef768a59865db631
|
| 296 |
+
```
|
| 297 |
+
""")
|
| 298 |
|
| 299 |
+
def _start(token_val, repo_val, files_val, csv_val, remote_base_val, workers_val, progress=gr.Progress()):
|
| 300 |
+
status_text, result = _handle_upload(token_val, repo_val, files_val, csv_val, remote_base_val, int(workers_val) if workers_val else None, progress=progress)
|
| 301 |
return status_text
|
| 302 |
|
| 303 |
upload_btn.click(_start, inputs=[token, repo_id, files, csv_file, remote_base, workers], outputs=[status])
|