Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -3,13 +3,13 @@ import torch
|
|
3 |
import numpy as np
|
4 |
import modin.pandas as pd
|
5 |
from PIL import Image
|
6 |
-
from diffusers import
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
|
9 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
10 |
torch.cuda.max_memory_allocated(device=device)
|
11 |
torch.cuda.empty_cache()
|
12 |
-
pipe =
|
13 |
|
14 |
# Open it for reduce GPU memory usage
|
15 |
pipe.enable_model_cpu_offload()
|
@@ -24,8 +24,8 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed):
|
|
24 |
guidance_scale=scale,
|
25 |
num_images_per_prompt=1,
|
26 |
num_inference_steps=steps,
|
27 |
-
width=
|
28 |
-
height=
|
29 |
|
30 |
return image
|
31 |
|
|
|
3 |
import numpy as np
|
4 |
import modin.pandas as pd
|
5 |
from PIL import Image
|
6 |
+
from diffusers import FluxPipeline
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
|
9 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
10 |
torch.cuda.max_memory_allocated(device=device)
|
11 |
torch.cuda.empty_cache()
|
12 |
+
pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
|
13 |
|
14 |
# Open it for reduce GPU memory usage
|
15 |
pipe.enable_model_cpu_offload()
|
|
|
24 |
guidance_scale=scale,
|
25 |
num_images_per_prompt=1,
|
26 |
num_inference_steps=steps,
|
27 |
+
width=width,
|
28 |
+
height=height, generator=generator).images[0]
|
29 |
|
30 |
return image
|
31 |
|