File size: 1,759 Bytes
a181620
 
 
 
760961f
 
 
a181620
760961f
a181620
760961f
a181620
 
 
 
 
 
 
 
760961f
a181620
 
760961f
a181620
760961f
a181620
 
760961f
a181620
760961f
 
a181620
760961f
a181620
760961f
a181620
760961f
a181620
760961f
a181620
 
 
 
760961f
 
a181620
760961f
a181620
760961f
a181620
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from huggingface_hub import hf_hub_download
import os

def download_assets():
    """Download necessary assets from Hugging Face Hub."""
    os.makedirs("data", exist_ok=True)
    os.makedirs("vectorstore/db_faiss", exist_ok=True)

    repo_id   = "MoizK/mindmedic-assets"
    repo_type = "dataset"
    token     = os.getenv("HUGGINGFACE_API_TOKEN")  # optional

    pdf_files = [
        "71763-gale-encyclopedia-of-medicine.-vol.-1.-2nd-ed.pdf",
        "Depression-NIM-2024.pdf",
        "Depression-and-Other-Common-Mental-Disorders-Global-Health-Estimates.pdf",
        "Doing-What-Matters-in-Times-of-Stress.pdf",
        "Generalized-Anxiety-Disorder-When-Worry-Gets-Out-of-Control.pdf",
        "WHO-mhGAP-Intervention-Guide-v2.pdf",
        "social-anxiety-disorder-more-than-just-shyness.pdf",
    ]

    for fname in pdf_files:
        try:
            hf_hub_download(
                repo_id=repo_id,
                repo_type=repo_type,
                filename=f"data/{fname}",
                local_dir=".",
                local_dir_use_symlinks=False,
                token=token,
            )
            print(f"Downloaded {fname}")
        except Exception as e:
            print(f"⚠️ Failed to download {fname}: {e}")

    for idx in ("index.faiss", "index.pkl"):
        try:
            hf_hub_download(
                repo_id=repo_id,
                repo_type=repo_type,
                filename=f"vectorstore/db_faiss/{idx}",
                local_dir=".",
                local_dir_use_symlinks=False,
                token=token,
            )
            print(f"Downloaded {idx}")
        except Exception as e:
            print(f"⚠️ Failed to download {idx}: {e}")

if __name__ == "__main__":
    download_assets()