Spaces:
Running
on
L40S
Running
on
L40S
Commit
•
511ace8
1
Parent(s):
94b944a
Update app.py
Browse files
app.py
CHANGED
@@ -25,13 +25,14 @@ transformer = FluxTransformer2DModel.from_pretrained(
|
|
25 |
subfolder="transformer",
|
26 |
torch_dtype=torch.bfloat16
|
27 |
)
|
|
|
28 |
pipe = FluxPipeline.from_pretrained(
|
29 |
"black-forest-labs/FLUX.1-dev",
|
30 |
transformer=transformer,
|
31 |
torch_dtype=torch.bfloat16
|
32 |
)
|
33 |
-
ip_model = IPAdapter(pipe, image_encoder_path, ipadapter_path, device="cuda", num_tokens=128)
|
34 |
|
|
|
35 |
|
36 |
def resize_img(image, max_size=1024):
|
37 |
width, height = image.size
|
@@ -95,12 +96,19 @@ with gr.Blocks(css=css) as demo:
|
|
95 |
label="Input Image",
|
96 |
type="pil"
|
97 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
prompt = gr.Text(
|
99 |
label="Prompt",
|
100 |
max_lines=1,
|
101 |
placeholder="Enter your prompt",
|
102 |
)
|
103 |
-
run_button = gr.Button("
|
104 |
|
105 |
with gr.Column():
|
106 |
result = gr.Image(label="Result")
|
@@ -122,7 +130,7 @@ with gr.Blocks(css=css) as demo:
|
|
122 |
minimum=256,
|
123 |
maximum=MAX_IMAGE_SIZE,
|
124 |
step=32,
|
125 |
-
value=
|
126 |
)
|
127 |
|
128 |
height = gr.Slider(
|
@@ -130,16 +138,8 @@ with gr.Blocks(css=css) as demo:
|
|
130 |
minimum=256,
|
131 |
maximum=MAX_IMAGE_SIZE,
|
132 |
step=32,
|
133 |
-
value=
|
134 |
)
|
135 |
-
|
136 |
-
scale = gr.Slider(
|
137 |
-
label="Scale",
|
138 |
-
minimum=0.0,
|
139 |
-
maximum=1.0,
|
140 |
-
step=0.1,
|
141 |
-
value=0.7,
|
142 |
-
)
|
143 |
|
144 |
run_button.click(
|
145 |
fn=process_image,
|
|
|
25 |
subfolder="transformer",
|
26 |
torch_dtype=torch.bfloat16
|
27 |
)
|
28 |
+
|
29 |
pipe = FluxPipeline.from_pretrained(
|
30 |
"black-forest-labs/FLUX.1-dev",
|
31 |
transformer=transformer,
|
32 |
torch_dtype=torch.bfloat16
|
33 |
)
|
|
|
34 |
|
35 |
+
ip_model = IPAdapter(pipe, image_encoder_path, ipadapter_path, device="cuda", num_tokens=128)
|
36 |
|
37 |
def resize_img(image, max_size=1024):
|
38 |
width, height = image.size
|
|
|
96 |
label="Input Image",
|
97 |
type="pil"
|
98 |
)
|
99 |
+
scale = gr.Slider(
|
100 |
+
label="Image Scale",
|
101 |
+
minimum=0.0,
|
102 |
+
maximum=1.0,
|
103 |
+
step=0.1,
|
104 |
+
value=0.7,
|
105 |
+
)
|
106 |
prompt = gr.Text(
|
107 |
label="Prompt",
|
108 |
max_lines=1,
|
109 |
placeholder="Enter your prompt",
|
110 |
)
|
111 |
+
run_button = gr.Button("Generate", variant="primary")
|
112 |
|
113 |
with gr.Column():
|
114 |
result = gr.Image(label="Result")
|
|
|
130 |
minimum=256,
|
131 |
maximum=MAX_IMAGE_SIZE,
|
132 |
step=32,
|
133 |
+
value=1024,
|
134 |
)
|
135 |
|
136 |
height = gr.Slider(
|
|
|
138 |
minimum=256,
|
139 |
maximum=MAX_IMAGE_SIZE,
|
140 |
step=32,
|
141 |
+
value=1024,
|
142 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
|
144 |
run_button.click(
|
145 |
fn=process_image,
|