Spaces:
Paused
Paused
Commit
•
5ee18ab
1
Parent(s):
1a058f6
Update votes file path
Browse files
main.py
CHANGED
@@ -17,7 +17,7 @@ from starlette.responses import RedirectResponse
|
|
17 |
load_dotenv()
|
18 |
logger = logging.getLogger(__name__)
|
19 |
|
20 |
-
VOTES_FILE = "
|
21 |
|
22 |
|
23 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
@@ -26,8 +26,7 @@ hf_api = HfApi(token=HF_TOKEN)
|
|
26 |
scheduler = CommitScheduler(
|
27 |
repo_id="davanstrien/summary-ratings",
|
28 |
repo_type="dataset",
|
29 |
-
folder_path="
|
30 |
-
path_in_repo="data",
|
31 |
every=1,
|
32 |
token=HF_TOKEN,
|
33 |
hf_api=hf_api,
|
@@ -37,16 +36,15 @@ scheduler = CommitScheduler(
|
|
37 |
@asynccontextmanager
|
38 |
async def lifespan(app: FastAPI):
|
39 |
logger.info("Running startup event")
|
40 |
-
if not Path(
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
)
|
50 |
logger.info(f"Downloaded votes.jsonl to {path}")
|
51 |
yield
|
52 |
|
|
|
17 |
load_dotenv()
|
18 |
logger = logging.getLogger(__name__)
|
19 |
|
20 |
+
VOTES_FILE = "data/votes.jsonl"
|
21 |
|
22 |
|
23 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
|
|
26 |
scheduler = CommitScheduler(
|
27 |
repo_id="davanstrien/summary-ratings",
|
28 |
repo_type="dataset",
|
29 |
+
folder_path="data",
|
|
|
30 |
every=1,
|
31 |
token=HF_TOKEN,
|
32 |
hf_api=hf_api,
|
|
|
36 |
@asynccontextmanager
|
37 |
async def lifespan(app: FastAPI):
|
38 |
logger.info("Running startup event")
|
39 |
+
if not Path(VOTES_FILE).exists():
|
40 |
+
path = hf_hub_download(
|
41 |
+
repo_id="davanstrien/summary-ratings",
|
42 |
+
filename="data/votes.jsonl",
|
43 |
+
repo_type="dataset",
|
44 |
+
token=HF_TOKEN,
|
45 |
+
local_dir=".",
|
46 |
+
local_dir_use_symlinks=False,
|
47 |
+
)
|
|
|
48 |
logger.info(f"Downloaded votes.jsonl to {path}")
|
49 |
yield
|
50 |
|