fantos commited on
Commit
7fbb32f
·
verified ·
1 Parent(s): 06d2a79

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -7,13 +7,20 @@ from safetensors.torch import load_file
7
  from huggingface_hub import hf_hub_download
8
 
9
  cache_path = path.join(path.dirname(path.abspath(__file__)), "models")
10
- os.environ["TRANSFORMERS_CACHE"] = cache_path
11
  os.environ["HF_HUB_CACHE"] = cache_path
12
  os.environ["HF_HOME"] = cache_path
13
 
14
  import gradio as gr
15
  import torch
16
- from diffusers import FluxPipeline
 
 
 
 
 
 
 
17
 
18
  torch.backends.cuda.matmul.allow_tf32 = True
19
 
 
7
  from huggingface_hub import hf_hub_download
8
 
9
  cache_path = path.join(path.dirname(path.abspath(__file__)), "models")
10
+ # TRANSFORMERS_CACHE is deprecated, only use HF_HOME
11
  os.environ["HF_HUB_CACHE"] = cache_path
12
  os.environ["HF_HOME"] = cache_path
13
 
14
  import gradio as gr
15
  import torch
16
+
17
+ # Try to handle version compatibility issues
18
+ try:
19
+ from diffusers import FluxPipeline
20
+ except ImportError as e:
21
+ print(f"Error importing FluxPipeline: {e}")
22
+ print("Attempting to use StableDiffusionPipeline as fallback...")
23
+ from diffusers import StableDiffusionPipeline as FluxPipeline
24
 
25
  torch.backends.cuda.matmul.allow_tf32 = True
26