zhoudewei.666 commited on
Commit
7a9f748
·
1 Parent(s): f291567

fix: import spaces before torch/diffusers to avoid CUDA init conflict

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,16 +3,16 @@ import os
3
  import threading
4
  import time
5
 
6
- import torch
7
- from diffusers import FlowMatchEulerDiscreteScheduler, QwenImageEditPlusPipeline
8
- from huggingface_hub import hf_hub_download
9
-
10
  try:
11
  import spaces
12
  _HAS_SPACES = True
13
  except ImportError:
14
  _HAS_SPACES = False
15
 
 
 
 
 
16
  def calculate_dimensions(target_area: int, ratio: float):
17
  width = math.sqrt(target_area * ratio)
18
  height = width / ratio
 
3
  import threading
4
  import time
5
 
 
 
 
 
6
  try:
7
  import spaces
8
  _HAS_SPACES = True
9
  except ImportError:
10
  _HAS_SPACES = False
11
 
12
+ import torch
13
+ from diffusers import FlowMatchEulerDiscreteScheduler, QwenImageEditPlusPipeline
14
+ from huggingface_hub import hf_hub_download
15
+
16
  def calculate_dimensions(target_area: int, ratio: float):
17
  width = math.sqrt(target_area * ratio)
18
  height = width / ratio