Spaces:
Sleeping
Sleeping
import os | |
import dotenv | |
from fasthtml.common import * | |
from huggingface_hub import HfApi, login, whoami | |
dotenv.load_dotenv() | |
login(token=os.environ.get("HF_TOKEN")) | |
api = HfApi() | |
hf_user = whoami(os.environ.get("HF_TOKEN"))["name"] | |
HF_REPO_ID_TXT = f"{hf_user}/zotero-answer-ai-texts" | |
HF_REPO_ID_IMG = f"{hf_user}/zotero-answer-ai-images" | |
app, rt = fast_app() | |
def get(): | |
info = api.dataset_info(HF_REPO_ID_TXT) | |
text_last_modified = info.last_modified.strftime("%d-%b-%y at %H:%M:%S") | |
info = api.dataset_info(HF_REPO_ID_IMG) | |
img_last_modified = info.last_modified.strftime("%d-%b-%y at %H:%M:%S") | |
return Titled( | |
"Zotero Refresh Pipeline", | |
Div( | |
H3("Status"), | |
P(f"{HF_REPO_ID_TXT} : {text_last_modified} (last updated)"), | |
P(f"{HF_REPO_ID_IMG}: {img_last_modified} (last updated)"), | |
), | |
) | |
serve() | |