Spaces:
Running
on
Zero
Running
on
Zero
Commit
•
a673085
1
Parent(s):
be2898d
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
from diffusers import
|
4 |
from diffusers.utils import load_image
|
5 |
-
from controlnet_flux import FluxControlNetModel
|
6 |
-
from transformer_flux import FluxTransformer2DModel
|
7 |
-
from pipeline_flux_controlnet_inpaint import FluxControlNetInpaintingPipeline
|
8 |
-
from transformers import T5EncoderModel, CLIPTextModel
|
9 |
from PIL import Image, ImageDraw
|
10 |
import numpy as np
|
11 |
import spaces
|
12 |
from huggingface_hub import hf_hub_download
|
13 |
-
from optimum.quanto import freeze, qfloat8, quantize
|
14 |
|
15 |
pipe = FluxFillPipeline.from_pretrained(
|
16 |
"black-forest-labs/FLUX.1-Fill-dev",
|
17 |
torch_dtype=torch.bfloat16
|
18 |
).to("cuda")
|
19 |
|
20 |
-
pipe.to("cuda")
|
21 |
-
|
22 |
def can_expand(source_width, source_height, target_width, target_height, alignment):
|
23 |
if alignment in ("Left", "Right") and source_width >= target_width:
|
24 |
return False
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
from diffusers import FluxFillPipeline
|
4 |
from diffusers.utils import load_image
|
5 |
+
#from controlnet_flux import FluxControlNetModel
|
6 |
+
#from transformer_flux import FluxTransformer2DModel
|
7 |
+
#from pipeline_flux_controlnet_inpaint import FluxControlNetInpaintingPipeline
|
8 |
+
#from transformers import T5EncoderModel, CLIPTextModel
|
9 |
from PIL import Image, ImageDraw
|
10 |
import numpy as np
|
11 |
import spaces
|
12 |
from huggingface_hub import hf_hub_download
|
13 |
+
#from optimum.quanto import freeze, qfloat8, quantize
|
14 |
|
15 |
pipe = FluxFillPipeline.from_pretrained(
|
16 |
"black-forest-labs/FLUX.1-Fill-dev",
|
17 |
torch_dtype=torch.bfloat16
|
18 |
).to("cuda")
|
19 |
|
|
|
|
|
20 |
def can_expand(source_width, source_height, target_width, target_height, alignment):
|
21 |
if alignment in ("Left", "Right") and source_width >= target_width:
|
22 |
return False
|