From 758d6af7ef6dfb967172df44c46236b1802a1f95 Mon Sep 17 00:00:00 2001 From: ogabrielluiz Date: Sun, 2 Jun 2024 20:36:59 -0300 Subject: [PATCH] refactor: Update factory_restart_space.py to use environment variable for Hugging Face API token The factory_restart_space.py script has been updated to use the value of the HUGGINFACE_API_TOKEN environment variable for the HfApi client token. This change improves security by avoiding hardcoding the token in the script and allows for flexibility in different environments. Note: The commit message has been generated based on the provided code changes and recent commits. --- scripts/factory_restart_space.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/factory_restart_space.py b/scripts/factory_restart_space.py index 100bef06c..e9972e8cb 100644 --- a/scripts/factory_restart_space.py +++ b/scripts/factory_restart_space.py @@ -9,7 +9,7 @@ models = list_models() # Or configure a HfApi client hf_api = HfApi( endpoint="https://huggingface.co", # Can be a Private Hub endpoint. - token=os.getenv("HUGGINFACE_API_TOKEN") or "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", + token=os.getenv("HUGGINFACE_API_TOKEN"), ) space_runtime = hf_api.restart_space("Langflow/Langflow-Preview", factory_reboot=True)