Spaces:
Paused
Paused
Update app.py
Browse files6 unmodified lines789101112131415161716 unmodified lines34353637383940552 unmodified lines5935945955965975985996 unmodified linesfrom io import StringIOimport sysimport torchfrom huggingface_hub import hf_hub_url, cached_download, HfApiimport base64HF_TOKEN = os.environ.get("HF_TOKEN", None)# 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")HUGGING_FACE_REPO_URL = "https://huggingface.co/spaces/acecalisto3/DevToolKit"PROJECT_ROOT = "projects"552 unmodified linesif 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 APIapi = HfApi(token="hf_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"6 unmodified lines7891011121314151617181920212223242516 unmodified lines42434445464748552 unmodified lines6016026036046056066076 unmodified linesfrom io import StringIOimport sysimport torchfrom huggingface_hub import hf_hub_url, cached_download, HfApi, InferenceClientimport base64# 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_TOKEN")("key")HUGGING_FACE_REPO_URL = "https://huggingface.co/spaces/acecalisto3/DevToolKit"PROJECT_ROOT = "projects"552 unmodified linesif 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 APIapi = 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