Spaces:
Paused
Paused
Update app.py
Browse files6 unmodified lines78910101112131314151617181920212223242516 unmodified lines4243443745464748552 unmodified lines6016026035966046056066076 unmodified linesfrom io import StringIOimport sysimport torchfrom huggingface_hub import hf_hub_url, cached_download, HfApifrom huggingface_hub import hf_hub_url, cached_download, HfApi, InferenceClientimport base64
HF_TOKEN = os.environ.get("HF_TOKEN", None)# Set environment variable for Hugging Face tokenos.environ["HUGGINGFACE_TOKEN"] = "your_token_here"
# Load .env file to set additional environment variablesload_dotenv()
# Use the HUGGINGFACE_TOKEN in your codeHUGGINGFACE_TOKEN = os.getenv("HUGGINGFACE_TOKEN")print(HUGGINGFACE_TOKEN)r# Add the new HTML code belowcustom_html = '''<div style='position:fixed;bottom:0;left:0;width:100%;'>16 unmodified lines# Set your Hugging Face API key here# hf_token = "YOUR_HUGGING_FACE_API_KEY" # Replace with your actual token# Get Hugging Face token from secrets.toml - this line should already be in the main codeHF_TOKEN = os.environ.get("huggingface")hf_token = os.environ.get("HUGGINGFACE_TOKEN")("key")
HUGGING_FACE_REPO_URL = "https://huggingface.co/spaces/acecalisto3/DevToolKit"PROJECT_ROOT = "projects"552 unmodified lines if agent._hf_api and agent.has_valid_hf_token(): agent.deploy_built_space_to_hf() # Use the hf_token to interact with the Hugging Face API api = HfApi(token="hf_token") api = HfApi(token="HUGGINGFACE_TOKEN") # Function to create a Space on Hugging Facedef create_space(api, name, description, public, files, entrypoint="launch.py"): url = f"{hf_hub_url()}spaces/{name}/prepare-repo"app.py+12-4