Spaces:
Running
Running
update
Browse files
app.py
CHANGED
|
@@ -6,14 +6,17 @@ from tqdm import tqdm
|
|
| 6 |
from PIL import Image
|
| 7 |
from utils import WaifuScorer
|
| 8 |
|
| 9 |
-
SCORER =
|
| 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 |
|