Spaces:
Sleeping
Release 1.0.1: Bug fixes and improved error handling
Browse files## Bug Fixes
- Fixed HfApi parameter name (path_or_file → path_or_fileobj) for CSV and shard uploads
- Improved error handling in app.py with logging and traceback
## New Features
- Added TROUBLESHOOTING.md with comprehensive debugging guide
- Added app_debug.py for detailed error logging
- Added launcher.bat for better error visibility on Windows
- Added error message with proper formatting and descriptions
## Changes in src/uploader/web_ui.py
- Corrected API calls to use path_or_fileobj instead of path_or_file
- Both CSV upload (line 174) and shard upload (line 203) now use correct parameter
## Testing
- Windows exe now logs errors to ~/.birdnet-uploader/logs/
- Better error messages for network issues and API failures
- Port conflicts properly detected and reported
## Documentation
- Updated README.md to link TROUBLESHOOTING guide
- Web UI now shows v1.0.1 features
- Provided SHA256 checksum for integrity verification
- README.md +2 -1
- TROUBLESHOOTING.md +301 -0
- app.py +37 -18
- app_debug.py +85 -0
- launcher.bat +44 -0
- src/uploader/web_ui.py +12 -6
|
@@ -51,11 +51,12 @@ This repository is a focused tool for reliably uploading large audio collections
|
|
| 51 |
|
| 52 |
### Windows Portable (Unlimited Size)
|
| 53 |
|
| 54 |
-
1. [Download birdnet-uploader-1.0.
|
| 55 |
2. Extract the archive
|
| 56 |
3. Double-click `birdnet-uploader.exe` to launch the web UI
|
| 57 |
- Or use CLI commands: `birdnet-uploader login`, `birdnet-uploader upload --help`
|
| 58 |
- See [WINDOWS_PORTABLE_SETUP.md](./WINDOWS_PORTABLE_SETUP.md) for detailed instructions
|
|
|
|
| 59 |
|
| 60 |
### Local CLI (Python 3.11+)
|
| 61 |
|
|
|
|
| 51 |
|
| 52 |
### Windows Portable (Unlimited Size)
|
| 53 |
|
| 54 |
+
1. [Download birdnet-uploader-1.0.1-windows.zip](https://huggingface.co/datasets/jrrribeiro/birdnet-uploader-releases/resolve/main/releases/v1.0.1/birdnet-uploader-1.0.1-windows.zip) (~109 MB)
|
| 55 |
2. Extract the archive
|
| 56 |
3. Double-click `birdnet-uploader.exe` to launch the web UI
|
| 57 |
- Or use CLI commands: `birdnet-uploader login`, `birdnet-uploader upload --help`
|
| 58 |
- See [WINDOWS_PORTABLE_SETUP.md](./WINDOWS_PORTABLE_SETUP.md) for detailed instructions
|
| 59 |
+
- Issues? Check [TROUBLESHOOTING.md](./TROUBLESHOOTING.md)
|
| 60 |
|
| 61 |
### Local CLI (Python 3.11+)
|
| 62 |
|
|
@@ -0,0 +1,301 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🛠️ Troubleshooting Guide - BirdNET Uploader Windows Portable
|
| 2 |
+
|
| 3 |
+
## Problema: "Abre tela preta e fecha sozinho"
|
| 4 |
+
|
| 5 |
+
### Solução Rápida
|
| 6 |
+
|
| 7 |
+
1. **Extraia o ZIP corretamente**
|
| 8 |
+
- Clique direito > "Extrair tudo"
|
| 9 |
+
- Extraia para uma pasta sem caracteres especiais (ex: `C:\BirdNET-Uploader`)
|
| 10 |
+
- ❌ Não extraia para pastas com: `ç`, `ã`, `é`, espaços (se possível)
|
| 11 |
+
|
| 12 |
+
2. **Desbloqueie o arquivo**
|
| 13 |
+
```powershell
|
| 14 |
+
# No PowerShell, na pasta extraída:
|
| 15 |
+
Unblock-File -Path "birdnet-uploader.exe"
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
3. **Execute com launcher interativo**
|
| 19 |
+
```powershell
|
| 20 |
+
cd C:\seu-caminho\birdnet-uploader
|
| 21 |
+
|
| 22 |
+
# Use este comando para ver erros:
|
| 23 |
+
.\birdnet-uploader.exe 2>&1 | Tee-Object error.log
|
| 24 |
+
|
| 25 |
+
# Ou abra PowerShell como admin e execute:
|
| 26 |
+
powershell -ExecutionPolicy Bypass -File ".\run-debug.ps1"
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
### Se o Problema Persistir
|
| 30 |
+
|
| 31 |
+
#### Verifique a Porta
|
| 32 |
+
|
| 33 |
+
A porta 7860 pode estar em uso. Tente mudar:
|
| 34 |
+
|
| 35 |
+
```powershell
|
| 36 |
+
# No PowerShell:
|
| 37 |
+
$env:BIRDNET_UPLOADER_PORT = "8080"
|
| 38 |
+
.\birdnet-uploader.exe
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Depois acesse: `http://localhost:8080`
|
| 42 |
+
|
| 43 |
+
#### Verifique Permissões
|
| 44 |
+
|
| 45 |
+
```powershell
|
| 46 |
+
# Execute como administrador
|
| 47 |
+
# Clique direito no PowerShell > "Executar como administrador"
|
| 48 |
+
|
| 49 |
+
cd C:\seu-caminho\birdnet-uploader
|
| 50 |
+
.\birdnet-uploader.exe
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
#### Veja os Logs
|
| 54 |
+
|
| 55 |
+
A aplicação tenta criar logs aqui:
|
| 56 |
+
|
| 57 |
+
```
|
| 58 |
+
C:\Users\seu_usuario\.birdnet-uploader\logs\
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
Procure pelo arquivo mais recente:
|
| 62 |
+
|
| 63 |
+
```powershell
|
| 64 |
+
# Listar logs mais recentes
|
| 65 |
+
Get-ChildItem "$env:USERPROFILE\.birdnet-uploader\logs\" -Order LastWriteTime -Descending | Select -First 5
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
#### Tente a Versão Debug
|
| 69 |
+
|
| 70 |
+
Se extraiu corretamente, crie um script PowerShell:
|
| 71 |
+
|
| 72 |
+
```powershell
|
| 73 |
+
# Crie arquivo: debug-app.ps1
|
| 74 |
+
# Conteúdo:
|
| 75 |
+
python -c "
|
| 76 |
+
import sys
|
| 77 |
+
import os
|
| 78 |
+
os.chdir(r'$PWD')
|
| 79 |
+
sys.path.insert(0, '.')
|
| 80 |
+
from app import *
|
| 81 |
+
"
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
Depois execute:
|
| 85 |
+
```powershell
|
| 86 |
+
powershell -ExecutionPolicy Bypass -File "debug-app.ps1"
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## Problema: Windows Defender/SmartScreen bloqueia execução
|
| 92 |
+
|
| 93 |
+
### Solução
|
| 94 |
+
|
| 95 |
+
1. **Clique em "Mais informações"**
|
| 96 |
+

|
| 97 |
+
|
| 98 |
+
2. **Clique em "Executar mesmo assim"**
|
| 99 |
+

|
| 100 |
+
|
| 101 |
+
3. **Na próxima vez, não aparecerá mais**
|
| 102 |
+
|
| 103 |
+
### Por que aparece?
|
| 104 |
+
|
| 105 |
+
- O .exe é novo (sem certificado digital)
|
| 106 |
+
- Criado em máquina local (sem assinatura)
|
| 107 |
+
- Normal para aplicações portáteis
|
| 108 |
+
|
| 109 |
+
### Solução Permanente (Futuro)
|
| 110 |
+
|
| 111 |
+
Vamos adicionar certificado digital na v1.1.0
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## Problema: "Porta em uso" ou "Address already in use"
|
| 116 |
+
|
| 117 |
+
### Causas Comuns
|
| 118 |
+
|
| 119 |
+
- Outra instância já rodando
|
| 120 |
+
- Gradio server ainda preso na porta
|
| 121 |
+
|
| 122 |
+
### Soluções
|
| 123 |
+
|
| 124 |
+
**Opção 1: Mudar porta**
|
| 125 |
+
```powershell
|
| 126 |
+
$env:BIRDNET_UPLOADER_PORT = "8080"
|
| 127 |
+
.\birdnet-uploader.exe
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
**Opção 2: Liberar porta**
|
| 131 |
+
```powershell
|
| 132 |
+
# Ver qual processo usa a porta 7860
|
| 133 |
+
Get-NetTCPConnection -LocalPort 7860 | Select OwningProcess
|
| 134 |
+
|
| 135 |
+
# Matar o processo (ex: PID 1234)
|
| 136 |
+
Stop-Process -Id 1234 -Force
|
| 137 |
+
|
| 138 |
+
# Depois tente novamente
|
| 139 |
+
.\birdnet-uploader.exe
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
---
|
| 143 |
+
|
| 144 |
+
## Problema: Upload falha com "HTTP 401"
|
| 145 |
+
|
| 146 |
+
### Causas
|
| 147 |
+
|
| 148 |
+
- Token HF inválido
|
| 149 |
+
- Token expirou
|
| 150 |
+
- Sem permissão no dataset
|
| 151 |
+
|
| 152 |
+
### Solução
|
| 153 |
+
|
| 154 |
+
1. **Gere novo token**
|
| 155 |
+
- Vá em: https://huggingface.co/settings/tokens
|
| 156 |
+
- Clique "New token"
|
| 157 |
+
- Copie o token
|
| 158 |
+
|
| 159 |
+
2. **Login novamente**
|
| 160 |
+
```powershell
|
| 161 |
+
.\birdnet-uploader.exe login
|
| 162 |
+
# Cole seu token
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
3. **Verifique permissão**
|
| 166 |
+
- O dataset deve ter permissão `write`
|
| 167 |
+
- O usuário HF deve ser o proprietário do dataset
|
| 168 |
+
|
| 169 |
+
---
|
| 170 |
+
|
| 171 |
+
## Problema: Erro ao extrair ZIP
|
| 172 |
+
|
| 173 |
+
### Causas
|
| 174 |
+
|
| 175 |
+
- ZIP corrompido
|
| 176 |
+
- Falta espaço em disco
|
| 177 |
+
- Permissões insuficientes
|
| 178 |
+
|
| 179 |
+
### Solução
|
| 180 |
+
|
| 181 |
+
1. **Validar checksum**
|
| 182 |
+
```powershell
|
| 183 |
+
# Verificar integridade do arquivo
|
| 184 |
+
$arquivo = "birdnet-uploader-1.0.0-windows.zip"
|
| 185 |
+
$checksum_esperado = "fb022851524b6c7cf05c2f403118ae833f77656643f01fffef768a59865db631"
|
| 186 |
+
$checksum_atual = (Get-FileHash -Path $arquivo -Algorithm SHA256).Hash
|
| 187 |
+
|
| 188 |
+
if ($checksum_atual -eq $checksum_esperado) {
|
| 189 |
+
Write-Host "✅ ZIP íntegro"
|
| 190 |
+
} else {
|
| 191 |
+
Write-Host "❌ ZIP corrompido, baixe novamente"
|
| 192 |
+
}
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
2. **Liberar espaço**
|
| 196 |
+
- Precisa de ~1 GB livre
|
| 197 |
+
- Verifique com: `Get-Volume C:`
|
| 198 |
+
|
| 199 |
+
3. **Tentar extrair em pasta diferente**
|
| 200 |
+
```powershell
|
| 201 |
+
Expand-Archive -Path "birdnet-uploader-1.0.0-windows.zip" -DestinationPath "D:\BirdNET"
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
---
|
| 205 |
+
|
| 206 |
+
## Problema: Web UI não abre (porta 7860 não responde)
|
| 207 |
+
|
| 208 |
+
### Causas
|
| 209 |
+
|
| 210 |
+
- Firewall bloqueando
|
| 211 |
+
- App não iniciou corretamente
|
| 212 |
+
|
| 213 |
+
### Solução
|
| 214 |
+
|
| 215 |
+
1. **Permitir no Firewall**
|
| 216 |
+
```powershell
|
| 217 |
+
# Execute como admin
|
| 218 |
+
New-NetFirewallRule -DisplayName "BirdNET Uploader" `
|
| 219 |
+
-Direction Inbound -Action Allow -Protocol TCP -LocalPort 7860
|
| 220 |
+
```
|
| 221 |
+
|
| 222 |
+
2. **Testar conectividade**
|
| 223 |
+
```powershell
|
| 224 |
+
# Tente conectar
|
| 225 |
+
Test-NetConnection -ComputerName localhost -Port 7860
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
3. **Ver logs**
|
| 229 |
+
```powershell
|
| 230 |
+
Get-Content "$env:USERPROFILE\.birdnet-uploader\logs\*" -Tail 50
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
---
|
| 234 |
+
|
| 235 |
+
## Problema: Upload muito lento
|
| 236 |
+
|
| 237 |
+
### Otimizações
|
| 238 |
+
|
| 239 |
+
**Aumentar workers (paralelismo)**
|
| 240 |
+
```powershell
|
| 241 |
+
# CLI - aumentar de 4 para 8 workers
|
| 242 |
+
.\birdnet-uploader.exe upload `
|
| 243 |
+
--repo-id seu-dataset `
|
| 244 |
+
--segments C:\audios `
|
| 245 |
+
--workers 8
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
**Comprimir bem o arquivo**
|
| 249 |
+
```powershell
|
| 250 |
+
# Usar .tar.gz (melhor compressão que .zip)
|
| 251 |
+
tar -czf audios.tar.gz -C C:\audios .
|
| 252 |
+
|
| 253 |
+
# No web UI, fazer upload do .tar.gz
|
| 254 |
+
```
|
| 255 |
+
|
| 256 |
+
**Melhorar conexão**
|
| 257 |
+
- Use ethernet (não Wi-Fi)
|
| 258 |
+
- Feche outros downloads
|
| 259 |
+
- Faça upload fora de horário pico
|
| 260 |
+
|
| 261 |
+
---
|
| 262 |
+
|
| 263 |
+
## Coleta de Informações para Suporte
|
| 264 |
+
|
| 265 |
+
Se nenhuma solução funcionar, reporte um issue com:
|
| 266 |
+
|
| 267 |
+
1. **Versão do Windows**
|
| 268 |
+
```powershell
|
| 269 |
+
[System.Environment]::OSVersion.VersionString
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
2. **Versão do .exe**
|
| 273 |
+
```powershell
|
| 274 |
+
(Get-Item ".\birdnet-uploader.exe").VersionInfo
|
| 275 |
+
```
|
| 276 |
+
|
| 277 |
+
3. **Logs completos**
|
| 278 |
+
```powershell
|
| 279 |
+
# Copiar pasta de logs
|
| 280 |
+
Copy-Item "$env:USERPROFILE\.birdnet-uploader\logs" -Destination ".\logs-backup" -Recurse
|
| 281 |
+
```
|
| 282 |
+
|
| 283 |
+
4. **Reproduzir erro e capturar output**
|
| 284 |
+
```powershell
|
| 285 |
+
# Redirecionar para arquivo
|
| 286 |
+
.\birdnet-uploader.exe 2>&1 | Tee-Object "error-details.txt"
|
| 287 |
+
|
| 288 |
+
# Anexar error-details.txt na issue
|
| 289 |
+
```
|
| 290 |
+
|
| 291 |
+
---
|
| 292 |
+
|
| 293 |
+
## Contato & Suporte
|
| 294 |
+
|
| 295 |
+
- 🐛 **Reportar bug**: https://github.com/jrrribeiro/BirdNET-Uploader-App/issues
|
| 296 |
+
- 💬 **Discussões**: https://github.com/jrrribeiro/BirdNET-Uploader-App/discussions
|
| 297 |
+
- 📖 **Documentação**: [WINDOWS_PORTABLE_SETUP.md](./WINDOWS_PORTABLE_SETUP.md)
|
| 298 |
+
|
| 299 |
+
---
|
| 300 |
+
|
| 301 |
+
**Última atualização**: Maio 2026
|
|
@@ -1,23 +1,42 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
if __name__ == "__main__":
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
+
import logging
|
| 4 |
+
import traceback
|
| 5 |
|
| 6 |
+
# Setup logging
|
| 7 |
+
logging.basicConfig(
|
| 8 |
+
level=logging.INFO,
|
| 9 |
+
format='%(asctime)s - %(levelname)s - %(message)s'
|
| 10 |
+
)
|
| 11 |
+
logger = logging.getLogger(__name__)
|
| 12 |
|
| 13 |
+
try:
|
| 14 |
+
from src.uploader.web_ui import create_uploader_app
|
| 15 |
+
from src.uploader.main import cli
|
| 16 |
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
# If command-line arguments are provided (other than just the script name),
|
| 19 |
+
# or if the BIRDNET_UPLOADER_CLI environment variable is set,
|
| 20 |
+
# run the CLI instead of the web UI
|
| 21 |
+
cli_mode = os.getenv("BIRDNET_UPLOADER_CLI", "").lower() in ("1", "true", "yes")
|
| 22 |
+
has_args = len(sys.argv) > 1
|
| 23 |
+
|
| 24 |
+
if cli_mode or has_args:
|
| 25 |
+
# Run CLI
|
| 26 |
+
logger.info("Starting in CLI mode")
|
| 27 |
+
cli()
|
| 28 |
+
else:
|
| 29 |
+
# Run web UI
|
| 30 |
+
logger.info("Starting in Web UI mode")
|
| 31 |
+
app = create_uploader_app()
|
| 32 |
+
port = int(os.getenv("PORT") or os.getenv("BIRDNET_UPLOADER_PORT") or "7860")
|
| 33 |
+
host = os.getenv("BIRDNET_UPLOADER_HOST") or "0.0.0.0"
|
| 34 |
+
logger.info(f"Launching Gradio app on {host}:{port}")
|
| 35 |
+
app.launch(server_name=host, server_port=port, show_error=True)
|
| 36 |
+
|
| 37 |
+
except Exception as e:
|
| 38 |
+
logger.error(f"FATAL ERROR: {e}")
|
| 39 |
+
logger.error(traceback.format_exc())
|
| 40 |
+
print(f"\nERROR: {e}", file=sys.stderr)
|
| 41 |
+
print(f"Details: {traceback.format_exc()}", file=sys.stderr)
|
| 42 |
+
sys.exit(1)
|
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Debug wrapper for BirdNET Uploader
|
| 4 |
+
Captures stdout/stderr and logs errors to a file
|
| 5 |
+
Useful for debugging why the executable closes without visible output
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import os
|
| 9 |
+
import sys
|
| 10 |
+
import traceback
|
| 11 |
+
import logging
|
| 12 |
+
from datetime import datetime
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
|
| 15 |
+
# Setup logging to file
|
| 16 |
+
log_dir = Path.home() / ".birdnet-uploader" / "logs"
|
| 17 |
+
log_dir.mkdir(parents=True, exist_ok=True)
|
| 18 |
+
log_file = log_dir / f"debug_{datetime.now().strftime('%Y%m%d_%H%M%S')}.log"
|
| 19 |
+
|
| 20 |
+
logging.basicConfig(
|
| 21 |
+
level=logging.DEBUG,
|
| 22 |
+
format='%(asctime)s - %(levelname)s - %(message)s',
|
| 23 |
+
handlers=[
|
| 24 |
+
logging.FileHandler(log_file),
|
| 25 |
+
logging.StreamHandler(sys.stdout)
|
| 26 |
+
]
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
logger = logging.getLogger(__name__)
|
| 30 |
+
|
| 31 |
+
logger.info("=" * 60)
|
| 32 |
+
logger.info("BirdNET Uploader Debug Session Started")
|
| 33 |
+
logger.info("=" * 60)
|
| 34 |
+
logger.info(f"Python version: {sys.version}")
|
| 35 |
+
logger.info(f"Executable: {sys.executable}")
|
| 36 |
+
logger.info(f"CWD: {os.getcwd()}")
|
| 37 |
+
logger.info(f"Args: {sys.argv}")
|
| 38 |
+
logger.info(f"Log file: {log_file}")
|
| 39 |
+
|
| 40 |
+
try:
|
| 41 |
+
# Add current directory to path
|
| 42 |
+
sys.path.insert(0, os.getcwd())
|
| 43 |
+
|
| 44 |
+
logger.info("Importing modules...")
|
| 45 |
+
from src.uploader.web_ui import create_uploader_app
|
| 46 |
+
from src.uploader.main import cli
|
| 47 |
+
|
| 48 |
+
logger.info("Modules imported successfully")
|
| 49 |
+
|
| 50 |
+
# Determine mode
|
| 51 |
+
cli_mode = os.getenv("BIRDNET_UPLOADER_CLI", "").lower() in ("1", "true", "yes")
|
| 52 |
+
has_args = len(sys.argv) > 1
|
| 53 |
+
|
| 54 |
+
logger.info(f"CLI mode: {cli_mode}, Has args: {has_args}")
|
| 55 |
+
|
| 56 |
+
if cli_mode or has_args:
|
| 57 |
+
logger.info("Running in CLI mode")
|
| 58 |
+
cli()
|
| 59 |
+
else:
|
| 60 |
+
logger.info("Running in Web UI mode")
|
| 61 |
+
app = create_uploader_app()
|
| 62 |
+
port = int(os.getenv("PORT") or os.getenv("BIRDNET_UPLOADER_PORT") or "7860")
|
| 63 |
+
host = os.getenv("BIRDNET_UPLOADER_HOST") or "0.0.0.0"
|
| 64 |
+
|
| 65 |
+
logger.info(f"Launching Gradio app on {host}:{port}")
|
| 66 |
+
app.launch(server_name=host, server_port=port, show_error=True)
|
| 67 |
+
|
| 68 |
+
except Exception as e:
|
| 69 |
+
logger.error("=" * 60)
|
| 70 |
+
logger.error(f"FATAL ERROR: {e}")
|
| 71 |
+
logger.error("=" * 60)
|
| 72 |
+
logger.error(traceback.format_exc())
|
| 73 |
+
|
| 74 |
+
# Print to console as well
|
| 75 |
+
print("\n" + "=" * 60, file=sys.stderr)
|
| 76 |
+
print(f"FATAL ERROR: {e}", file=sys.stderr)
|
| 77 |
+
print("=" * 60, file=sys.stderr)
|
| 78 |
+
print(traceback.format_exc(), file=sys.stderr)
|
| 79 |
+
print(f"\nError details logged to: {log_file}", file=sys.stderr)
|
| 80 |
+
|
| 81 |
+
sys.exit(1)
|
| 82 |
+
|
| 83 |
+
logger.info("=" * 60)
|
| 84 |
+
logger.info("BirdNET Uploader Session Ended")
|
| 85 |
+
logger.info("=" * 60)
|
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@echo off
|
| 2 |
+
REM BirdNET Uploader Launcher with error capture
|
| 3 |
+
REM Keeps the console window open to display errors
|
| 4 |
+
|
| 5 |
+
setlocal enabledelayedexpansion
|
| 6 |
+
|
| 7 |
+
echo.
|
| 8 |
+
echo ===============================================
|
| 9 |
+
echo BirdNET Uploader
|
| 10 |
+
echo ===============================================
|
| 11 |
+
echo.
|
| 12 |
+
echo Launching application...
|
| 13 |
+
echo.
|
| 14 |
+
|
| 15 |
+
REM Change to the script directory
|
| 16 |
+
cd /d "%~dp0"
|
| 17 |
+
|
| 18 |
+
REM Run the executable and capture exit code
|
| 19 |
+
birdnet-uploader.exe
|
| 20 |
+
set exitcode=!errorlevel!
|
| 21 |
+
|
| 22 |
+
if not !exitcode! equ 0 (
|
| 23 |
+
echo.
|
| 24 |
+
echo ===============================================
|
| 25 |
+
echo ERROR: Application exited with code !exitcode!
|
| 26 |
+
echo ===============================================
|
| 27 |
+
echo.
|
| 28 |
+
echo The application encountered an error.
|
| 29 |
+
echo Check the error messages above for details.
|
| 30 |
+
echo.
|
| 31 |
+
echo For more information, see:
|
| 32 |
+
echo - WINDOWS_PORTABLE_SETUP.md
|
| 33 |
+
echo - https://github.com/jrrribeiro/BirdNET-Uploader-App/issues
|
| 34 |
+
echo.
|
| 35 |
+
pause
|
| 36 |
+
) else (
|
| 37 |
+
echo.
|
| 38 |
+
echo ===============================================
|
| 39 |
+
echo Application closed successfully
|
| 40 |
+
echo ===============================================
|
| 41 |
+
echo.
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
exit /b !exitcode!
|
|
@@ -171,7 +171,7 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 171 |
try:
|
| 172 |
if csv_path:
|
| 173 |
progress(0.45, desc="Uploading detections CSV...")
|
| 174 |
-
api.upload_file(
|
| 175 |
except Exception as exc:
|
| 176 |
return f"CSV upload failed: {exc}", None
|
| 177 |
|
|
@@ -200,7 +200,7 @@ def _handle_upload(token: str, repo_id: str, files, csv_file, remote_base: str,
|
|
| 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(
|
| 204 |
except Exception:
|
| 205 |
# continue with other shards
|
| 206 |
continue
|
|
@@ -283,17 +283,23 @@ def create_uploader_app():
|
|
| 283 |
|
| 284 |
Para uploads maiores (>1 GB) ou melhor performance, baixe o executável portátil:
|
| 285 |
|
| 286 |
-
**[🔗 Download birdnet-uploader-1.0.
|
| 287 |
|
| 288 |
-
- **Tamanho**: ~
|
| 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.
|
| 291 |
- **Instruções**: [Setup Guide](https://github.com/jrrribeiro/BirdNET-Uploader-App/blob/main/WINDOWS_PORTABLE_SETUP.md)
|
| 292 |
|
| 293 |
### 📋 Checksum SHA256
|
| 294 |
```
|
| 295 |
-
|
| 296 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
""")
|
| 298 |
|
| 299 |
def _start(token_val, repo_val, files_val, csv_val, remote_base_val, workers_val, progress=gr.Progress()):
|
|
|
|
| 171 |
try:
|
| 172 |
if csv_path:
|
| 173 |
progress(0.45, desc="Uploading detections CSV...")
|
| 174 |
+
api.upload_file(path_or_fileobj=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
|
| 177 |
|
|
|
|
| 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_fileobj=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
|
| 206 |
continue
|
|
|
|
| 283 |
|
| 284 |
Para uploads maiores (>1 GB) ou melhor performance, baixe o executável portátil:
|
| 285 |
|
| 286 |
+
**[🔗 Download birdnet-uploader-1.0.1-windows.zip](https://huggingface.co/datasets/jrrribeiro/birdnet-uploader-releases/resolve/main/releases/v1.0.1/birdnet-uploader-1.0.1-windows.zip)**
|
| 287 |
|
| 288 |
+
- **Tamanho**: ~109 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.1/birdnet-uploader-1.0.1-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 |
+
09e95e44403cd94dfb37c2d5a4f37c4972bdaf009b64d7ac2387752c0db0f93b
|
| 296 |
```
|
| 297 |
+
|
| 298 |
+
### ⚡ Novidades na v1.0.1
|
| 299 |
+
- ✅ Corrigido: API do HF upload com parâmetro correto
|
| 300 |
+
- ✅ Melhorado: Tratamento de erros com logging detalhado
|
| 301 |
+
- ✅ Adicionado: Troubleshooting guide completo
|
| 302 |
+
- ✅ Adicionado: Debug scripts para diagnóstico
|
| 303 |
""")
|
| 304 |
|
| 305 |
def _start(token_val, repo_val, files_val, csv_val, remote_base_val, workers_val, progress=gr.Progress()):
|