Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 |
-
|
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 |
|
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 |
|