Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,6 @@ load_dotenv()
|
|
15 |
# Initialize FastAPI application
|
16 |
app = FastAPI()
|
17 |
|
18 |
-
# Set the cache directory for Hugging Face
|
19 |
os.environ["HF_HOME"] = "/tmp/huggingface_cache"
|
20 |
|
21 |
# Ensure the cache directory exists
|
@@ -30,7 +29,8 @@ logging.basicConfig(level=logging.INFO)
|
|
30 |
huggingface_token = os.getenv('HUGGINGFACE_HUB_TOKEN')
|
31 |
if huggingface_token:
|
32 |
try:
|
33 |
-
|
|
|
34 |
logging.info("Successfully logged into Hugging Face Hub.")
|
35 |
except Exception as e:
|
36 |
logging.error(f"Failed to log into Hugging Face Hub: {e}")
|
|
|
15 |
# Initialize FastAPI application
|
16 |
app = FastAPI()
|
17 |
|
|
|
18 |
os.environ["HF_HOME"] = "/tmp/huggingface_cache"
|
19 |
|
20 |
# Ensure the cache directory exists
|
|
|
29 |
huggingface_token = os.getenv('HUGGINGFACE_HUB_TOKEN')
|
30 |
if huggingface_token:
|
31 |
try:
|
32 |
+
# Log in to Hugging Face without adding credentials to Git
|
33 |
+
login(token=huggingface_token, add_to_git_credential=False)
|
34 |
logging.info("Successfully logged into Hugging Face Hub.")
|
35 |
except Exception as e:
|
36 |
logging.error(f"Failed to log into Hugging Face Hub: {e}")
|