import gradio as gr import os # 1. This securely reads the token you just saved in the Space's settings. # The token itself is NOT in the code. hf_token = os.environ.get("HF_TOKEN") if not hf_token: raise ValueError("HF_TOKEN secret is not set. Please add it to your Space settings.") # 2. This uses your secret token to "unlock" and load your private Space. print(f"Attempting to load private Space: spaces/StatsTech/StatsEasy") demo = gr.load("spaces/StatsTech/StatsEasy", hf_token=hf_token) print("Private Space loaded successfully.") # 3. This launches the loaded app. demo.launch() import gradio as gr demo = gr.load("spaces/StatsTech/StatsEasy") demo.launch()