Update app.py
Browse files
app.py
CHANGED
@@ -16,14 +16,14 @@ from gradio.events import Events
|
|
16 |
from gradio.exceptions import Error
|
17 |
from gradio_client import utils as client_utils
|
18 |
from transformers import pipeline
|
19 |
-
from diffusers import DiffusionPipeline
|
20 |
import torch
|
21 |
import gradio as gr
|
22 |
|
23 |
# Corrected code with closed parenthesis and explicit token handling
|
24 |
-
image_model =
|
25 |
-
"black-forest-labs/FLUX.1-dev",
|
26 |
-
torch_dtype=torch.bfloat16,
|
27 |
use_auth_token=os.getenv("HUGGINGFACE_TOKEN")
|
28 |
)
|
29 |
image_model.enable_model_cpu_offload()
|
|
|
16 |
from gradio.exceptions import Error
|
17 |
from gradio_client import utils as client_utils
|
18 |
from transformers import pipeline
|
19 |
+
from diffusers import DiffusionPipeline
|
20 |
import torch
|
21 |
import gradio as gr
|
22 |
|
23 |
# Corrected code with closed parenthesis and explicit token handling
|
24 |
+
image_model = DiffusionPipeline.from_pretrained(
|
25 |
+
"black-forest-labs/FLUX.1-dev",
|
26 |
+
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
|
27 |
use_auth_token=os.getenv("HUGGINGFACE_TOKEN")
|
28 |
)
|
29 |
image_model.enable_model_cpu_offload()
|