Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,15 +4,23 @@ import spaces
|
|
| 4 |
import torch
|
| 5 |
import random
|
| 6 |
from PIL import Image
|
|
|
|
| 7 |
|
| 8 |
from diffusers import FluxPipeline, FluxTransformer2DModel, GGUFQuantizationConfig
|
| 9 |
from diffusers.utils import load_image
|
| 10 |
|
| 11 |
MAX_SEED = np.iinfo(np.int32).max
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
transformer = FluxTransformer2DModel.from_single_file(
|
| 15 |
-
|
| 16 |
quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
|
| 17 |
torch_dtype=torch.bfloat16,
|
| 18 |
)
|
|
|
|
| 4 |
import torch
|
| 5 |
import random
|
| 6 |
from PIL import Image
|
| 7 |
+
from huggingface_hub import hf_hub_download
|
| 8 |
|
| 9 |
from diffusers import FluxPipeline, FluxTransformer2DModel, GGUFQuantizationConfig
|
| 10 |
from diffusers.utils import load_image
|
| 11 |
|
| 12 |
MAX_SEED = np.iinfo(np.int32).max
|
| 13 |
|
| 14 |
+
# Download GGUF model file first
|
| 15 |
+
gguf_file = hf_hub_download(
|
| 16 |
+
repo_id="bullerwins/FLUX.1-Kontext-dev-GGUF",
|
| 17 |
+
filename="flux1-kontext-dev-Q8_0.gguf",
|
| 18 |
+
local_dir="./models"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Load GGUF transformer model
|
| 22 |
transformer = FluxTransformer2DModel.from_single_file(
|
| 23 |
+
gguf_file,
|
| 24 |
quantization_config=GGUFQuantizationConfig(compute_dtype=torch.bfloat16),
|
| 25 |
torch_dtype=torch.bfloat16,
|
| 26 |
)
|