File size: 895 Bytes
43bc104
 
 
 
0889949
43bc104
 
 
0889949
43bc104
 
0889949
 
748a8f9
0889949
748a8f9
 
 
 
0889949
 
 
 
 
 
 
 
 
 
 
 
 
 
43bc104
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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()


@rt("/")
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()