birds_c271_test_DB / hf_setup.py
braedenb's picture
Update hf_setup.py
b1e4bf8
from huggingface_hub import HfApi, HfFolder
import os
def download_file(path, url):
api = HfApi()
folder = HfFolder()
token = folder.get_token()
api.download_file(url, path, token)
def setup():
if not os.path.exists("bird_info.csv"):
download_file("bird_info.csv", "https://huggingface.co/spaces/braedenb/demo_space/raw/main/bird_info.csv")
if not os.path.exists("class_indices_c271.json"):
download_file("class_indices_c271.json", "https://huggingface.co/spaces/braedenb/demo_space/raw/main/class_indices_c271.json")
if not os.path.exists("styles.css"):
download_file("styles.css", "https://huggingface.co/spaces/braedenb/demo_space/raw/main/styles.css")