Spaces:
Running
Running
Rename
Browse files18 unmodified lines1920212223242521 unmodified lines474849505152532 unmodified lines565758596061621 unmodified line6465666768697018 unmodified linesDESCRIPTION = 'This is an unofficial demo for https://github.com/KichangKim/DeepDanbooru.'ARTICLE = '<center><img src="https://visitor-badge.glitch.me/badge?page_id=hysts.deepdanbooru" alt="visitor badge"/></center>'TOKEN = os.environ['TOKEN']MODEL_REPO = 'hysts/DeepDanbooru'MODEL_FILENAME = 'model-resnet_custom_v3.h5'LABEL_FILENAME = 'tags.txt'21 unmodified linespath = huggingface_hub.hf_hub_download(dataset_repo,'images.tar.gz',repo_type='dataset',use_auth_token=TOKEN)with tarfile.open(path) as f:f.extractall()return sorted(image_dir.glob('*'))2 unmodified linesdef load_model() -> tf.keras.Model:path = huggingface_hub.hf_hub_download(MODEL_REPO,MODEL_FILENAME,use_auth_token=TOKEN)model = tf.keras.models.load_model(path)return model1 unmodified linedef load_labels() -> list[str]:path = huggingface_hub.hf_hub_download(MODEL_REPO,LABEL_FILENAME,use_auth_token=TOKEN)with open(path) as f:labels = [line.strip() for line in f.readlines()]return labels18 unmodified lines1920212223242521 unmodified lines474849505152532 unmodified lines565758596061621 unmodified line6465666768697018 unmodified linesDESCRIPTION = 'This is an unofficial demo for https://github.com/KichangKim/DeepDanbooru.'ARTICLE = '<center><img src="https://visitor-badge.glitch.me/badge?page_id=hysts.deepdanbooru" alt="visitor badge"/></center>'HF_TOKEN = os.environ['HF_TOKEN']MODEL_REPO = 'hysts/DeepDanbooru'MODEL_FILENAME = 'model-resnet_custom_v3.h5'LABEL_FILENAME = 'tags.txt'21 unmodified linespath = huggingface_hub.hf_hub_download(dataset_repo,'images.tar.gz',repo_type='dataset',use_auth_token=HF_TOKEN)with tarfile.open(path) as f:f.extractall()return sorted(image_dir.glob('*'))2 unmodified linesdef load_model() -> tf.keras.Model:path = huggingface_hub.hf_hub_download(MODEL_REPO,MODEL_FILENAME,use_auth_token=HF_TOKEN)model = tf.keras.models.load_model(path)return model1 unmodified linedef load_labels() -> list[str]:path = huggingface_hub.hf_hub_download(MODEL_REPO,LABEL_FILENAME,use_auth_token=HF_TOKEN)with open(path) as f:labels = [line.strip() for line in f.readlines()]return labels
app.py+4-4