lampongyuen's picture
Update app.py
5847ba4 verified
raw
history blame contribute delete
574 Bytes
import gradio as gr
import os
from dotenv import load_dotenv
load_dotenv()
# Your private Space repository ID
private_space_repo = "lampongyuen/gradio-app1"
# Your Hugging Face API token with access to the private Space (set as a secret in the Space settings)
hf_token = os.getenv("HF_TOKEN")
print(f"Token loaded: {'Yes' if hf_token else 'No'}")
if not hf_token:
raise ValueError("HF_TOKEN environment variable not set!")
# Specify src="spaces" and pass hf_token for authentication
iface = gr.load(private_space_repo, src="spaces", token=hf_token)
iface.launch()