hysts HF staff commited on
Commit
601183c
1 Parent(s): 3be8a88
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -19,7 +19,7 @@ TITLE = 'KichangKim/DeepDanbooru'
19
  DESCRIPTION = 'This is an unofficial demo for https://github.com/KichangKim/DeepDanbooru.'
20
  ARTICLE = '<center><img src="https://visitor-badge.glitch.me/badge?page_id=hysts.deepdanbooru" alt="visitor badge"/></center>'
21
 
22
- TOKEN = os.environ['TOKEN']
23
  MODEL_REPO = 'hysts/DeepDanbooru'
24
  MODEL_FILENAME = 'model-resnet_custom_v3.h5'
25
  LABEL_FILENAME = 'tags.txt'
@@ -47,7 +47,7 @@ def load_sample_image_paths() -> list[pathlib.Path]:
47
  path = huggingface_hub.hf_hub_download(dataset_repo,
48
  'images.tar.gz',
49
  repo_type='dataset',
50
- use_auth_token=TOKEN)
51
  with tarfile.open(path) as f:
52
  f.extractall()
53
  return sorted(image_dir.glob('*'))
@@ -56,7 +56,7 @@ def load_sample_image_paths() -> list[pathlib.Path]:
56
  def load_model() -> tf.keras.Model:
57
  path = huggingface_hub.hf_hub_download(MODEL_REPO,
58
  MODEL_FILENAME,
59
- use_auth_token=TOKEN)
60
  model = tf.keras.models.load_model(path)
61
  return model
62
 
@@ -64,7 +64,7 @@ def load_model() -> tf.keras.Model:
64
  def load_labels() -> list[str]:
65
  path = huggingface_hub.hf_hub_download(MODEL_REPO,
66
  LABEL_FILENAME,
67
- use_auth_token=TOKEN)
68
  with open(path) as f:
69
  labels = [line.strip() for line in f.readlines()]
70
  return labels
 
19
  DESCRIPTION = 'This is an unofficial demo for https://github.com/KichangKim/DeepDanbooru.'
20
  ARTICLE = '<center><img src="https://visitor-badge.glitch.me/badge?page_id=hysts.deepdanbooru" alt="visitor badge"/></center>'
21
 
22
+ HF_TOKEN = os.environ['HF_TOKEN']
23
  MODEL_REPO = 'hysts/DeepDanbooru'
24
  MODEL_FILENAME = 'model-resnet_custom_v3.h5'
25
  LABEL_FILENAME = 'tags.txt'
 
47
  path = huggingface_hub.hf_hub_download(dataset_repo,
48
  'images.tar.gz',
49
  repo_type='dataset',
50
+ use_auth_token=HF_TOKEN)
51
  with tarfile.open(path) as f:
52
  f.extractall()
53
  return sorted(image_dir.glob('*'))
 
56
  def load_model() -> tf.keras.Model:
57
  path = huggingface_hub.hf_hub_download(MODEL_REPO,
58
  MODEL_FILENAME,
59
+ use_auth_token=HF_TOKEN)
60
  model = tf.keras.models.load_model(path)
61
  return model
62
 
 
64
  def load_labels() -> list[str]:
65
  path = huggingface_hub.hf_hub_download(MODEL_REPO,
66
  LABEL_FILENAME,
67
+ use_auth_token=HF_TOKEN)
68
  with open(path) as f:
69
  labels = [line.strip() for line in f.readlines()]
70
  return labels