import os import sys from pathlib import Path from huggingface_hub import snapshot_download import shutil PRIVATE_REPO = "cybercentinel/ai-red-teaming" CACHE_DIR = Path("/tmp/sentitrust_cache") # Download the private space print("Loading SentiTrust AI Security Toolkit...") # Clear cache to force fresh download of latest version if CACHE_DIR.exists(): print("Clearing cache to get latest updates...") shutil.rmtree(CACHE_DIR) CACHE_DIR.mkdir(parents=True, exist_ok=True) try: snapshot_download( repo_id=PRIVATE_REPO, repo_type="space", local_dir=CACHE_DIR, token=os.environ.get("HF_TOKEN") ) print("Starting AI Red-Teaming Toolkit...") # Add to path and execute the downloaded app sys.path.insert(0, str(CACHE_DIR)) # Execute the app.py file directly with proper globals app_path = CACHE_DIR / "app.py" with open(app_path) as f: code = f.read() # Provide all necessary globals including __file__ exec_globals = { "__name__": "__main__", "__file__": str(app_path), "__builtins__": __builtins__ } exec(code, exec_globals) except Exception as e: # Show professional error page if loading fails print(f"Error loading toolkit: {e}") import traceback traceback.print_exc() import gradio as gr with gr.Blocks() as demo: gr.HTML("""

SentiTrust AI Security Toolkit

The toolkit is temporarily unavailable. Please try again in a moment.

If the issue persists, please contact our team.

Visit SentiTrust.com → Book Free Scan →

hello@adogent.com

""") demo.launch( server_name="0.0.0.0", server_port=7860, share=False )