Skip to content

Commit b91523c

Browse files
committed
ignore python3.9
1 parent d9d42b9 commit b91523c

File tree

5 files changed

+54
-35
lines changed

5 files changed

+54
-35
lines changed

.ci/ignore_treon_docker.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,5 @@ notebooks/olmocr-pdf-vlm/olmocr-pdf-vlm.ipynb
8787
notebooks/minicpm-o-omnimodal-chatbot/minicpm-o-omnimodal-chatbot.ipynb
8888
notebooks/kokoro/kokoro.ipynb
8989
notebooks/qwen2.5-omni-chatbot/qwen2.5-omni-chatbot.ipynb
90-
notebooks/intern-video2-classiciation/intern-video2-classification.ipynb
90+
notebooks/intern-video2-classiciation/intern-video2-classification.ipynb
91+
notebooks/flex.2-image-generation/flex.2-image-generation.ipynb

.ci/skipped_notebooks.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,3 +542,7 @@
542542
- macos-13
543543
- ubuntu-22.04
544544
- windows-2019
545+
- notebook: notebooks/flex.2-image-generation/flex.2-image-generation.ipynb
546+
skips:
547+
- python:
548+
- "3.9"

notebooks/flex.2-image-generation/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ The tutorial consists of the following steps:
3535
This is a self-contained example that relies solely on its own code.</br>
3636
We recommend running the notebook in a virtual environment. You only need a Jupyter server to start.
3737
For further details, please refer to [Installation Guide](../../README.md).
38-
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=5b5a4db0-7875-4bfb-bdbd-01698b5b1a77&file=../notebooks/flex.2-image-generation/README.md" />
38+
39+
<img referrerpolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=5b5a4db0-7875-4bfb-bdbd-01698b5b1a77&file=notebooks/flex.2-image-generation/README.md" />

notebooks/flex.2-image-generation/flex.2-image-generation.ipynb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"We recommend running the notebook in a virtual environment. You only need a Jupyter server to start.\n",
3737
"For details, please refer to [Installation Guide](https://github.com/openvinotoolkit/openvino_notebooks/blob/latest/README.md#-installation-guide).\n",
3838
"\n",
39-
"<img referrerpolicy=\"no-referrer-when-downgrade\" src=\"https://static.scarf.sh/a.png?x-pxid=5b5a4db0-7875-4bfb-bdbd-01698b5b1a77&file=../notebooks/flex.2-image-generation/flex.2-image-generation.ipynb\" />\n"
39+
"<img referrerpolicy=\"no-referrer-when-downgrade\" src=\"https://static.scarf.sh/a.png?x-pxid=5b5a4db0-7875-4bfb-bdbd-01698b5b1a77&file=notebooks/flex.2-image-generation/flex.2-image-generation.ipynb\" />\n"
4040
]
4141
},
4242
{
@@ -131,7 +131,9 @@
131131
"cell_type": "code",
132132
"execution_count": 3,
133133
"metadata": {
134-
"test_replace": {"ostris/Flex.2-preview": "katuni4ka/tiny-random-flex.2-preview"}
134+
"test_replace": {
135+
"ostris/Flex.2-preview": "katuni4ka/tiny-random-flex.2-preview"
136+
}
135137
},
136138
"outputs": [
137139
{
@@ -189,8 +191,8 @@
189191
" additional_args.update({\"weight-format\": \"int8\"})\n",
190192
" else:\n",
191193
" additional_args.update({\"weight-format\": \"fp16\"})\n",
192-
" \n",
193-
" optimum_cli(model_id, model_path, additional_args=additional_args)\n"
194+
"\n",
195+
" optimum_cli(model_id, model_path, additional_args=additional_args)"
194196
]
195197
},
196198
{
@@ -300,7 +302,7 @@
300302
"else:\n",
301303
" control_image = load_image(str(depth_path))\n",
302304
"\n",
303-
"make_image_grid([inpaint_image, inpaint_mask, control_image], rows=1, cols=3)\n"
305+
"make_image_grid([inpaint_image, inpaint_mask, control_image], rows=1, cols=3)"
304306
]
305307
},
306308
{
@@ -361,7 +363,7 @@
361363
" width=512,\n",
362364
" guidance_scale=3.5,\n",
363365
" num_inference_steps=20,\n",
364-
" generator=torch.Generator(\"cpu\").manual_seed(42)\n",
366+
" generator=torch.Generator(\"cpu\").manual_seed(42),\n",
365367
").images[0]\n",
366368
"\n",
367369
"image"

notebooks/flex.2-image-generation/gradio_helper.py

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@
99

1010

1111
def make_demo(pipe):
12-
def infer(edit_images, prompt, seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=3.5, control_strength=0.5, control_stop=0.33, num_inference_steps=50, progress=gr.Progress(track_tqdm=True)):
12+
def infer(
13+
edit_images,
14+
prompt,
15+
seed=42,
16+
randomize_seed=False,
17+
width=1024,
18+
height=1024,
19+
guidance_scale=3.5,
20+
control_strength=0.5,
21+
control_stop=0.33,
22+
num_inference_steps=50,
23+
progress=gr.Progress(track_tqdm=True),
24+
):
1325
image = edit_images["background"].convert("RGB")
1426
mask = Image.fromarray(np.array(edit_images["layers"][-1])[:, :, -1])
1527
if randomize_seed:
@@ -21,10 +33,10 @@ def infer(edit_images, prompt, seed=42, randomize_seed=False, width=1024, height
2133
height=height,
2234
width=width,
2335
guidance_scale=guidance_scale,
24-
control_strength=control_strength,
36+
control_strength=control_strength,
2537
control_stop=control_stop,
2638
num_inference_steps=num_inference_steps,
27-
generator=torch.Generator("cpu").manual_seed(seed)
39+
generator=torch.Generator("cpu").manual_seed(seed),
2840
).images[0]
2941
return (image, out_image), seed
3042

@@ -162,24 +174,26 @@ def infer(edit_images, prompt, seed=42, randomize_seed=False, width=1024, height
162174
with gr.Column(elem_id="col-container"):
163175
# Header with gradient
164176
with gr.Column(elem_classes=["header-container"]):
165-
gr.HTML("""
177+
gr.HTML(
178+
"""
166179
<h1>Flex.2 Preview Inpainting OpenVINO Demo</h1>
167-
""")
180+
"""
181+
)
168182
# Main interface container
169183
with gr.Column(elem_classes=["container"]):
170184
with gr.Row():
171185
# Left column: Input
172186
with gr.Column(scale=1):
173187
edit_image = gr.ImageEditor(
174-
label='Upload and draw mask for inpainting',
175-
type='pil',
188+
label="Upload and draw mask for inpainting",
189+
type="pil",
176190
sources=["upload", "webcam"],
177-
image_mode='RGB',
191+
image_mode="RGB",
178192
layers=False,
179193
brush=gr.Brush(colors=["#FFFFFF"], color_mode="fixed"),
180-
height=500
194+
height=500,
181195
)
182-
196+
183197
with gr.Column(elem_classes=["prompt-container"]):
184198
prompt = gr.Text(
185199
label="Your creative prompt",
@@ -188,17 +202,12 @@ def infer(edit_images, prompt, seed=42, randomize_seed=False, width=1024, height
188202
placeholder="Describe what you want to generate...",
189203
container=True,
190204
)
191-
205+
192206
run_button = gr.Button("✨ Generate", elem_classes=["btn-primary"])
193207
# Right column: Output
194208
with gr.Column(scale=1, elem_classes=["result-container"]):
195-
result = gr.ImageSlider(
196-
label="Before & After",
197-
type="pil",
198-
image_mode='RGB',
199-
elem_classes=["result-animation"]
200-
)
201-
209+
result = gr.ImageSlider(label="Before & After", type="pil", image_mode="RGB", elem_classes=["result-animation"])
210+
202211
# Advanced settings in a nice container
203212
with gr.Column(elem_classes=["settings-container"]):
204213
with gr.Accordion("Advanced Settings", open=False, elem_classes=["accordion-header"]):
@@ -212,30 +221,32 @@ def infer(edit_images, prompt, seed=42, randomize_seed=False, width=1024, height
212221
value=0,
213222
)
214223
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
215-
224+
216225
with gr.Row():
217226
height = gr.Slider(64, 2048, value=512, step=64, label="Height")
218227
width = gr.Slider(64, 2048, value=512, step=64, label="Width")
219-
228+
220229
with gr.Row():
221230
guidance_scale = gr.Slider(0.0, 20.0, value=3.5, step=0.1, label="Guidance Scale")
222231
control_strength = gr.Slider(0.0, 1.0, value=0.5, step=0.05, label="Control Strength")
223-
232+
224233
with gr.Row():
225234
control_stop = gr.Slider(0.0, 1.0, value=0.33, step=0.05, label="Control Stop")
226235
num_inference_steps = gr.Slider(1, 100, value=20, step=1, label="Inference Steps")
227-
236+
228237
# Footer
229-
gr.HTML("""
238+
gr.HTML(
239+
"""
230240
<div class="footer">
231241
<p>Flex.2 Preview Inpainting OpenVINO Demo</p>
232242
</div>
233-
""")
243+
"""
244+
)
234245

235246
run_button.click(
236247
fn=infer,
237248
inputs=[edit_image, prompt, seed, randomize_seed, width, height, guidance_scale, control_strength, control_stop, num_inference_steps],
238-
outputs=[result, seed]
249+
outputs=[result, seed],
239250
)
240-
241-
return demo
251+
252+
return demo

0 commit comments

Comments
 (0)