Eugeoter commited on
Commit
261903d
1 Parent(s): 0e39454

switch to CPU

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -1,17 +1,16 @@
1
  import gradio as gr
2
- import spaces
3
  from PIL import Image
4
  from utils import WaifuScorer
5
 
6
  SCORER = None
7
 
8
 
9
- @spaces.GPU
10
  def score_image(image: Image.Image) -> float:
11
  global SCORER
12
  if SCORER is None:
13
  SCORER = WaifuScorer(
14
- device='cuda',
15
  verbose=True,
16
  )
17
  return SCORER([image])[0]
 
1
  import gradio as gr
2
+ import torch
3
  from PIL import Image
4
  from utils import WaifuScorer
5
 
6
  SCORER = None
7
 
8
 
 
9
  def score_image(image: Image.Image) -> float:
10
  global SCORER
11
  if SCORER is None:
12
  SCORER = WaifuScorer(
13
+ device='cuda' if torch.cuda.is_available() else 'cpu',
14
  verbose=True,
15
  )
16
  return SCORER([image])[0]