Eugeoter commited on
Commit
2f76171
1 Parent(s): 94b23c1
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -6,14 +6,17 @@ from tqdm import tqdm
6
  from PIL import Image
7
  from utils import WaifuScorer
8
 
9
- SCORER = WaifuScorer(
10
- device='cuda',
11
- verbose=True,
12
- )
13
 
14
 
15
  @spaces.GPU
16
  def score_image(image: Image.Image) -> float:
 
 
 
 
 
 
17
  return SCORER([image])[0]
18
 
19
 
 
6
  from PIL import Image
7
  from utils import WaifuScorer
8
 
9
+ SCORER = None
 
 
 
10
 
11
 
12
  @spaces.GPU
13
  def score_image(image: Image.Image) -> float:
14
+ global SCORER
15
+ if SCORER is None:
16
+ SCORER = WaifuScorer(
17
+ device='cuda',
18
+ verbose=True,
19
+ )
20
  return SCORER([image])[0]
21
 
22