taesiri commited on
Commit
ce86d1c
1 Parent(s): d60d34b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -5,14 +5,13 @@ import spaces
5
 
6
 
7
  # Check if CUDA is available and set the device accordingly
8
- device = "cuda" if torch.cuda.is_available() else "cpu"
9
-
10
- model = CLIPModel.from_pretrained("openai/clip-vit-base-patch16").to(device)
11
  processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch16")
12
 
13
 
14
- @spaces.GPU
15
  def calculate_score(image, text):
 
16
  labels = text.split(";")
17
  labels = [l.strip() for l in labels]
18
  labels = list(filter(None, labels))
 
5
 
6
 
7
  # Check if CUDA is available and set the device accordingly
8
+ model = CLIPModel.from_pretrained("openai/clip-vit-base-patch16").to("cuda")
 
 
9
  processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch16")
10
 
11
 
12
+ @spaces.GPU(duration=120)
13
  def calculate_score(image, text):
14
+ print(device)
15
  labels = text.split(";")
16
  labels = [l.strip() for l in labels]
17
  labels = list(filter(None, labels))