gokaygokay commited on
Commit
b2cd494
1 Parent(s): f26cf7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -6,9 +6,20 @@ from aura_sr import AuraSR
6
  import torch
7
  import spaces
8
 
 
 
 
 
 
 
 
9
  # Initialize the AuraSR model
10
  aura_sr = AuraSR.from_pretrained("fal-ai/AuraSR")
11
 
 
 
 
 
12
  def process_image(input_image):
13
  if input_image is None:
14
  return None
 
6
  import torch
7
  import spaces
8
 
9
+ # Force CPU usage
10
+ torch.set_default_tensor_type(torch.FloatTensor)
11
+
12
+ # Override torch.load to always use CPU
13
+ original_load = torch.load
14
+ torch.load = lambda *args, **kwargs: original_load(*args, **kwargs, map_location=torch.device('cpu'))
15
+
16
  # Initialize the AuraSR model
17
  aura_sr = AuraSR.from_pretrained("fal-ai/AuraSR")
18
 
19
+ # Restore original torch.load
20
+ torch.load = original_load
21
+
22
+ @spaces.GPU
23
  def process_image(input_image):
24
  if input_image is None:
25
  return None