Spaces:
Sleeping
Sleeping
File size: 930 Bytes
8500fe0 6caeaf6 8500fe0 6caeaf6 8500fe0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # app.py (Inside your PUBLIC Space)
import os
import sys
from huggingface_hub import snapshot_download
# 1. Fetch the secure token from the environment secrets
HF_TOKEN = os.environ.get("HF_TOKEN")
if not HF_TOKEN:
import gradio as gr
with gr.Blocks() as demo:
gr.Markdown("## ❌ Configuration Error: Missing Secret Token.")
demo.launch()
else:
# 2. Safely clone your private repo files directly into the running instance container
# Replace 'your-username/my-secret-logic' with your actual private space path
local_dir = snapshot_download(
repo_id="llbba/core",
repo_type="space",
token=HF_TOKEN
)
# 3. Add the temporary downloaded path to Python's look-up engine
sys.path.insert(0, local_dir)
# 4. Import your app structure from the downloaded files and start it
from main_app import create_ui
demo = create_ui()
demo.launch() |