My-AI-Projects commited on
Commit
501091f
Β·
verified Β·
1 Parent(s): 4a6fce9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1,10 +1,11 @@
1
  import gradio as gr
2
  import torch
3
- from diffusers import DiffusionPipeline
4
  from PIL import Image
5
 
6
  # Load the diffusion model
7
- pipeline = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
 
8
 
9
  # Set the model to the appropriate device
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
1
  import gradio as gr
2
  import torch
3
+ from diffusers import FluxPipeline
4
  from PIL import Image
5
 
6
  # Load the diffusion model
7
+ pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
8
+ pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
9
 
10
  # Set the model to the appropriate device
11
  device = "cuda" if torch.cuda.is_available() else "cpu"