Download examples/audit_example.py from TecnoPopular/tecnopopular-audit: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/TecnoPopular/tecnopopular-audit/resolve/main/examples/audit_example.py
- Command line
-
hf download hf://TecnoPopular/tecnopopular-audit/examples/audit_example.py
-
curl -L -o audit_example.py https://huggingface.co/TecnoPopular/tecnopopular-audit/resolve/main/examples/audit_example.py
1.34 kB
| #!/usr/bin/env python3 | |
| """ | |
| examples/audit_example.py | |
| Exemplo de utilizacao do Protocolo de Auditoria Civica TecnoPopular (CTP-1.0). | |
| Demonstra como inspecionar uma URL e interpretar o laudo tecnico emitido. | |
| """ | |
| import sys | |
| from pathlib import Path | |
| # Adicionar diretorio pai para permitir import direto | |
| sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) | |
| from evaluator import CivicEvaluator | |
| from models import AuditLevel | |
| def main(): | |
| evaluator = CivicEvaluator() | |
| # Simular inspecao em um portal publico | |
| print("[*] Iniciando auditoria de exemplo...") | |
| report = evaluator.audit_target( | |
| tool_id="dados-abertos-exemplo", | |
| tool_name="Portal Civico Modelo", | |
| target_url="https://dados.gov.br", | |
| declared_sources=["CGU", "TSE"], | |
| declared_repo="https://github.com/governo/dados-abertos" | |
| ) | |
| print(f"Nome da Ferramenta: {report.tool_name}") | |
| print(f"Score Consolidado: {report.total_score:.1f} / 100") | |
| print(f"Status Final: {report.status.value.upper()}") | |
| print(f"Selo Atribuido: {report.badge_label}") | |
| print("-" * 50) | |
| print("Notas por Dimensao:") | |
| for dim, score in report.dimension_scores.items(): | |
| print(f" - {dim.value}: {score.raw_score:.1f}/100 ({score.weighted_score:.1f} pts ponderados)") | |
| if __name__ == "__main__": | |
| main() | |