yeq6x commited on
Commit
e7d7d62
1 Parent(s): c8099eb

@spaces.GPU

Browse files
Files changed (2) hide show
  1. scripts/anime.py +3 -0
  2. scripts/generate_prompt.py +3 -0
scripts/anime.py CHANGED
@@ -14,9 +14,12 @@ from kornia.enhance import equalize_clahe
14
  from PIL import Image
15
  import numpy as np
16
 
 
 
17
  model = None
18
  device = None
19
 
 
20
  def init_model(use_local=False):
21
  global model, device
22
  model_opt = "default"
 
14
  from PIL import Image
15
  import numpy as np
16
 
17
+ import spaces
18
+
19
  model = None
20
  device = None
21
 
22
+ @spaces.GPU
23
  def init_model(use_local=False):
24
  global model, device
25
  model_opt = "default"
scripts/generate_prompt.py CHANGED
@@ -10,6 +10,8 @@ from tensorflow.keras.layers import TFSMLayer
10
  from huggingface_hub import hf_hub_download
11
  from pathlib import Path
12
 
 
 
13
  # 画像サイズの設定
14
  IMAGE_SIZE = 448
15
 
@@ -39,6 +41,7 @@ def download_model_files(repo_id, model_dir, sub_dir, files, sub_files):
39
  for file in sub_files:
40
  hf_hub_download(repo_id, file, subfolder=sub_dir, cache_dir=os.path.join(model_dir, sub_dir), force_download=True, force_filename=file)
41
 
 
42
  def load_wd14_tagger_model():
43
  """WD14タグ付けモデルをロード"""
44
  model_dir = "wd14_tagger_model"
 
10
  from huggingface_hub import hf_hub_download
11
  from pathlib import Path
12
 
13
+ import spaces
14
+
15
  # 画像サイズの設定
16
  IMAGE_SIZE = 448
17
 
 
41
  for file in sub_files:
42
  hf_hub_download(repo_id, file, subfolder=sub_dir, cache_dir=os.path.join(model_dir, sub_dir), force_download=True, force_filename=file)
43
 
44
+ @spaces.GPU
45
  def load_wd14_tagger_model():
46
  """WD14タグ付けモデルをロード"""
47
  model_dir = "wd14_tagger_model"