Download scripts/hugging_face_struct.py from aionaion/chatdoc: direct link, hf CLI and curl.
- Browser
- Download file 2.42 kB
-
https://huggingface.co/spaces/aionaion/chatdoc/resolve/main/scripts/hugging_face_struct.py
- Command line
-
hf download hf://spaces/aionaion/chatdoc/scripts/hugging_face_struct.py
-
curl -L -o hugging_face_struct.py https://huggingface.co/spaces/aionaion/chatdoc/resolve/main/scripts/hugging_face_struct.py
2.42 kB
| #!/usr/bin/env python3 | |
| """ | |
| check_hf_structure.py - Verificar estrutura no Hugging Face | |
| """ | |
| from huggingface_hub import HfApi | |
| from dotenv import load_dotenv | |
| import os | |
| load_dotenv() | |
| api = HfApi() | |
| repo_id = "aionaion/chatdoc" | |
| token = os.getenv("HUGGINGFACE_HUB_TOKEN") | |
| print(f"🔍 Verificando estrutura do repositório: {repo_id}") | |
| try: | |
| # Listar TODOS os arquivos | |
| files = api.list_repo_files(repo_id=repo_id, repo_type="space") | |
| print(f"\n📁 Total de arquivos: {len(files)}") | |
| print("\n📋 Estrutura de pastas:") | |
| # Organizar por pasta | |
| from collections import defaultdict | |
| folders = defaultdict(list) | |
| for file in files: | |
| if '/' in file: | |
| folder = file.split('/')[0] | |
| folders[folder].append(file) | |
| else: | |
| folders['root'].append(file) | |
| for folder, files_in_folder in sorted(folders.items()): | |
| print(f"\n📂 {folder}/ ({len(files_in_folder)} arquivos):") | |
| for file in sorted(files_in_folder)[:10]: | |
| print(f" 📄 {file}") | |
| if len(files_in_folder) > 10: | |
| print(f" ... e mais {len(files_in_folder) - 10} arquivos") | |
| # Verificar especificamente a estrutura data/ | |
| data_files = [f for f in files if f.startswith('data/')] | |
| print(f"\n🎯 Arquivos em data/: {len(data_files)}") | |
| if data_files: | |
| # Mostrar estrutura da pasta data | |
| data_structure = defaultdict(list) | |
| for file in data_files: | |
| parts = file.split('/') | |
| if len(parts) >= 2: | |
| subfolder = parts[1] | |
| data_structure[subfolder].append(file) | |
| for subfolder, subfiles in sorted(data_structure.items()): | |
| print(f"\n 📁 data/{subfolder}/ ({len(subfiles)} arquivos):") | |
| for file in sorted(subfiles)[:5]: | |
| print(f" 📄 {file}") | |
| if len(subfiles) > 5: | |
| print(f" ... e mais {len(subfiles) - 5} arquivos") | |
| # Verificar se há algum problema com caminhos | |
| print(f"\n🔍 Verificando problemas com caminhos...") | |
| for file in files: | |
| if '\\' in file: | |
| print(f" ⚠️ Caminho com barra invertida: {file}") | |
| if file.startswith('./') or file.startswith('.\\'): | |
| print(f" ⚠️ Caminho relativo: {file}") | |
| except Exception as e: | |
| print(f"❌ Erro: {e}") |