amaye15
commited on
Commit
•
022365f
1
Parent(s):
8d0d89f
webhook
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import os
|
2 |
import gc
|
|
|
3 |
import shutil
|
4 |
import logging
|
5 |
from pathlib import Path
|
@@ -7,9 +8,6 @@ from huggingface_hub import WebhooksServer, WebhookPayload
|
|
7 |
from datasets import Dataset, load_dataset, disable_caching
|
8 |
from fastapi import BackgroundTasks, Response, status
|
9 |
|
10 |
-
import shutil
|
11 |
-
from pathlib import Path
|
12 |
-
|
13 |
|
14 |
def clear_huggingface_cache():
|
15 |
# Path to the Hugging Face cache directory
|
@@ -88,6 +86,7 @@ async def handle_repository_changes(
|
|
88 |
Adds a task to the background task queue to process the dataset
|
89 |
asynchronously.
|
90 |
"""
|
|
|
91 |
clear_huggingface_cache()
|
92 |
logger.info(
|
93 |
f"Webhook received from {payload.repo.name} indicating a repo {payload.event.action}"
|
|
|
1 |
import os
|
2 |
import gc
|
3 |
+
import time
|
4 |
import shutil
|
5 |
import logging
|
6 |
from pathlib import Path
|
|
|
8 |
from datasets import Dataset, load_dataset, disable_caching
|
9 |
from fastapi import BackgroundTasks, Response, status
|
10 |
|
|
|
|
|
|
|
11 |
|
12 |
def clear_huggingface_cache():
|
13 |
# Path to the Hugging Face cache directory
|
|
|
86 |
Adds a task to the background task queue to process the dataset
|
87 |
asynchronously.
|
88 |
"""
|
89 |
+
time.sleep(15)
|
90 |
clear_huggingface_cache()
|
91 |
logger.info(
|
92 |
f"Webhook received from {payload.repo.name} indicating a repo {payload.event.action}"
|