| import os # Make sure to import os module | |
| import gradio as gr | |
| from huggingface_hub import HfApi | |
| # Use the token from the Secrets Manager | |
| token = os.environ.get('pass') # Retrieve your stored secret | |
| # Check access to the private Space using the token, specifying repo_type="space" | |
| api = HfApi() | |
| repo_info = api.repo_info(repo_id="peymoon/test", token=token, repo_type="space") | |
| print(repo_info) # This will print out information about the private Space | |
| # Load the private Space using the Hugging Face token | |
| demo = gr.load("peymoon/test", hf_token=token, src="spaces") | |
| # Launch the public-facing interface | |
| demo.launch() | |