chris-rannou HF Staff commited on
Commit
2045fd8
·
verified ·
1 Parent(s): e23ce1e

Fix "CUDA has been initialized before importing the `spaces` package"

Browse files

Diffusers package initializes CUDA leading to the "CUDA has been initialized before importing the `spaces` package" error.
Moving up the `spaces` import fixes the issue

Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -1,9 +1,9 @@
 
1
  import gradio as gr
2
  import torch
3
  from diffusers import StableDiffusionXLPipeline, EulerDiscreteScheduler
4
  from huggingface_hub import hf_hub_download
5
  from safetensors.torch import load_file
6
- import spaces
7
  import os
8
  from PIL import Image
9
 
 
1
+ import spaces
2
  import gradio as gr
3
  import torch
4
  from diffusers import StableDiffusionXLPipeline, EulerDiscreteScheduler
5
  from huggingface_hub import hf_hub_download
6
  from safetensors.torch import load_file
 
7
  import os
8
  from PIL import Image
9