add hf_token
Browse files- update_scheduler.py +2 -1
update_scheduler.py
CHANGED
@@ -2,6 +2,7 @@ import datetime
|
|
2 |
import pathlib
|
3 |
import re
|
4 |
import tempfile
|
|
|
5 |
|
6 |
import pandas as pd
|
7 |
import requests
|
@@ -12,7 +13,7 @@ from huggingface_hub.utils import RepositoryNotFoundError
|
|
12 |
|
13 |
class SpaceRestarter:
|
14 |
def __init__(self, space_id: str):
|
15 |
-
self.api = HfApi()
|
16 |
if self.api.get_token_permission() != "write":
|
17 |
raise ValueError(f"The HF token must have write permission. space_id: {space_id}")
|
18 |
try:
|
|
|
2 |
import pathlib
|
3 |
import re
|
4 |
import tempfile
|
5 |
+
import os
|
6 |
|
7 |
import pandas as pd
|
8 |
import requests
|
|
|
13 |
|
14 |
class SpaceRestarter:
|
15 |
def __init__(self, space_id: str):
|
16 |
+
self.api = HfApi(token= os.getenv("HF_TOKEN"))
|
17 |
if self.api.get_token_permission() != "write":
|
18 |
raise ValueError(f"The HF token must have write permission. space_id: {space_id}")
|
19 |
try:
|