Spaces:
Sleeping
Sleeping
| import os | |
| import sys | |
| from pathlib import Path | |
| from huggingface_hub import snapshot_download | |
| import importlib.util | |
| PRIVATE_REPO = "cybercentinel/ai-red-teaming" | |
| CACHE = Path("cache") | |
| def load_toolkit(): | |
| """Load the full SentiTrust AI Red-Teaming Toolkit from private repository.""" | |
| try: | |
| print("Loading SentiTrust AI Security Toolkit...") | |
| CACHE.mkdir(exist_ok=True) | |
| # Download the complete toolkit from private space | |
| snapshot_download( | |
| repo_id=PRIVATE_REPO, | |
| repo_type="space", | |
| local_dir=CACHE, | |
| token=os.environ.get("HF_TOKEN") | |
| ) | |
| # Import and execute the main application | |
| sys.path.insert(0, str(CACHE)) | |
| spec = importlib.util.spec_from_file_location("app", CACHE / "app.py") | |
| app = importlib.util.module_from_spec(spec) | |
| spec.loader.exec_module(app) | |
| except Exception as e: | |
| # Show professional error page if loading fails | |
| import gradio as gr | |
| with gr.Blocks() as demo: | |
| gr.HTML(""" | |
| <div style="background: #0a0a0a; padding: 60px 30px; border-radius: 12px; text-align: center; color: white; max-width: 800px; margin: 40px auto;"> | |
| <h1 style="color: #dc2626; font-size: 2.5em; margin-bottom: 20px;"> | |
| SentiTrust AI Security Toolkit | |
| </h1> | |
| <p style="color: rgba(255,255,255,0.8); font-size: 1.2em; margin-bottom: 30px;"> | |
| The toolkit is temporarily unavailable. Please try again in a moment. | |
| </p> | |
| <p style="color: rgba(255,255,255,0.6); font-size: 0.95em; margin-bottom: 40px;"> | |
| If the issue persists, please contact our team. | |
| </p> | |
| <div style="margin-top: 30px;"> | |
| <a href="https://sentitrust.adogent.com" target="_blank" | |
| style="display: inline-block; background: #dc2626; color: white; padding: 16px 32px; | |
| border-radius: 8px; text-decoration: none; font-weight: 700; margin: 8px; font-size: 1.1em;"> | |
| Visit SentiTrust.com → | |
| </a> | |
| <a href="https://calendly.com/sentitrust/free-security-scan" target="_blank" | |
| style="display: inline-block; background: white; color: #0a0a0a; padding: 16px 32px; | |
| border-radius: 8px; text-decoration: none; font-weight: 700; margin: 8px; font-size: 1.1em;"> | |
| Book Free Scan → | |
| </a> | |
| </div> | |
| <p style="color: rgba(255,255,255,0.4); font-size: 0.85em; margin-top: 40px;"> | |
| hello@adogent.com | |
| </p> | |
| </div> | |
| """) | |
| demo.launch() | |
| if __name__ == "__main__": | |
| load_toolkit() | |