Spaces:
Runtime error
Runtime error
try to load latest diffusers
Browse files- app.py +3 -3
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import spaces # Must be imported first for ZeroGPU
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
-
from diffusers import DiffusionPipeline, FluxPipeline, FluxImg2ImgPipeline
|
| 6 |
from diffusers.utils import load_image
|
| 7 |
from PIL import Image
|
| 8 |
import os
|
|
@@ -50,10 +50,10 @@ def load_pipeline():
|
|
| 50 |
print("Loading FLUX Kontext pipeline...")
|
| 51 |
try:
|
| 52 |
# Try FluxImg2ImgPipeline first
|
| 53 |
-
pipeline =
|
| 54 |
"black-forest-labs/FLUX.1-Kontext-dev",
|
| 55 |
torch_dtype=dtype,
|
| 56 |
-
|
| 57 |
).to('cuda')
|
| 58 |
print("Pipeline loaded successfully with FluxImg2ImgPipeline!")
|
| 59 |
except Exception as e:
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import torch
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
+
from diffusers import DiffusionPipeline, FluxPipeline, FluxKontextPipeline, FluxImg2ImgPipeline
|
| 6 |
from diffusers.utils import load_image
|
| 7 |
from PIL import Image
|
| 8 |
import os
|
|
|
|
| 50 |
print("Loading FLUX Kontext pipeline...")
|
| 51 |
try:
|
| 52 |
# Try FluxImg2ImgPipeline first
|
| 53 |
+
pipeline = FluxKontextPipeline.from_pretrained(
|
| 54 |
"black-forest-labs/FLUX.1-Kontext-dev",
|
| 55 |
torch_dtype=dtype,
|
| 56 |
+
use_auth_token=os.environ.get("HF_TOKEN"),
|
| 57 |
).to('cuda')
|
| 58 |
print("Pipeline loaded successfully with FluxImg2ImgPipeline!")
|
| 59 |
except Exception as e:
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
torch>=2.0.0
|
| 2 |
-
diffusers
|
| 3 |
transformers>=4.38.0
|
| 4 |
accelerate>=0.26.0
|
| 5 |
safetensors>=0.4.0
|
|
|
|
| 1 |
torch>=2.0.0
|
| 2 |
+
git+https://github.com/huggingface/diffusers.git@main
|
| 3 |
transformers>=4.38.0
|
| 4 |
accelerate>=0.26.0
|
| 5 |
safetensors>=0.4.0
|