Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,6 @@ from datetime import datetime
|
|
| 6 |
import gradio as gr
|
| 7 |
import spaces
|
| 8 |
import torch
|
| 9 |
-
from diffusers import FluxPipeline
|
| 10 |
from diffusers import FluxControlNetModel
|
| 11 |
from diffusers import FluxControlNetPipeline
|
| 12 |
from PIL import Image
|
|
@@ -16,7 +15,7 @@ from aoti import aoti_load
|
|
| 16 |
|
| 17 |
|
| 18 |
controlnet = FluxControlNetModel.from_pretrained('InstantX/FLUX.1-dev-controlnet-canny', torch_dtype=torch.bfloat16)
|
| 19 |
-
pipeline =
|
| 20 |
pipeline.transformer.fuse_qkv_projections()
|
| 21 |
aoti_load(pipeline.transformer, 'zerogpu-aoti/FLUX.1')
|
| 22 |
|
|
@@ -42,6 +41,5 @@ gr.Interface(
|
|
| 42 |
fn=generate_image,
|
| 43 |
inputs=['image', 'text'],
|
| 44 |
outputs=['gallery'],
|
| 45 |
-
examples=["A cat playing with a ball of yarn"],
|
| 46 |
cache_examples=False,
|
| 47 |
).launch()
|
|
|
|
| 6 |
import gradio as gr
|
| 7 |
import spaces
|
| 8 |
import torch
|
|
|
|
| 9 |
from diffusers import FluxControlNetModel
|
| 10 |
from diffusers import FluxControlNetPipeline
|
| 11 |
from PIL import Image
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
controlnet = FluxControlNetModel.from_pretrained('InstantX/FLUX.1-dev-controlnet-canny', torch_dtype=torch.bfloat16)
|
| 18 |
+
pipeline = FluxControlNetPipeline.from_pretrained('black-forest-labs/FLUX.1-dev', torch_dtype=torch.bfloat16, controlnet=controlnet).to('cuda')
|
| 19 |
pipeline.transformer.fuse_qkv_projections()
|
| 20 |
aoti_load(pipeline.transformer, 'zerogpu-aoti/FLUX.1')
|
| 21 |
|
|
|
|
| 41 |
fn=generate_image,
|
| 42 |
inputs=['image', 'text'],
|
| 43 |
outputs=['gallery'],
|
|
|
|
| 44 |
cache_examples=False,
|
| 45 |
).launch()
|