SkalskiP commited on
Commit
92f75b1
·
1 Parent(s): 7c304e4

Revert "skip examples for now"

Browse files

This reverts commit 93bcc9cf2191e844beb73ffb881fa633295d8165.

Files changed (1) hide show
  1. app.py +51 -51
app.py CHANGED
@@ -41,36 +41,36 @@ def remove_background(image: Image.Image, threshold: int = 50) -> Image.Image:
41
  return image
42
 
43
 
44
- # EXAMPLES = [
45
- # [
46
- # None,
47
- # {
48
- # "background": Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-image.png", stream=True).raw),
49
- # "layers": [remove_background(Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-mask-2.png", stream=True).raw))],
50
- # "composite": Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-composite-2.png", stream=True).raw),
51
- # },
52
- # "little lion",
53
- # None,
54
- # 42,
55
- # False,
56
- # 0.85,
57
- # 30
58
- # ],
59
- # [
60
- # None,
61
- # {
62
- # "background": Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-image.png", stream=True).raw),
63
- # "layers": [remove_background(Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-mask-3.png", stream=True).raw))],
64
- # "composite": Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-composite-3.png", stream=True).raw),
65
- # },
66
- # "tattoos",
67
- # None,
68
- # 42,
69
- # False,
70
- # 0.85,
71
- # 30
72
- # ]
73
- # ]
74
 
75
  pipe = FluxInpaintPipeline.from_pretrained(
76
  "black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16).to(DEVICE)
@@ -240,27 +240,27 @@ with gr.Blocks() as demo:
240
  with gr.Accordion("Debug", open=False):
241
  output_mask_component = gr.Image(
242
  type='pil', image_mode='RGB', label='Input mask', format="png")
243
- # with gr.Row():
244
- # gr.Examples(
245
- # fn=process,
246
- # examples=EXAMPLES,
247
- # inputs=[
248
- # input_image_editor_component,
249
- # inpainting_prompt_text_component,
250
- # masking_prompt_text_component,
251
- # masking_prompt_text_component,
252
- # seed_slicer_component,
253
- # randomize_seed_checkbox_component,
254
- # strength_slider_component,
255
- # num_inference_steps_slider_component
256
- # ],
257
- # outputs=[
258
- # output_image_component,
259
- # output_mask_component
260
- # ],
261
- # run_on_click=True,
262
- # cache_examples=True
263
- # )
264
 
265
  submit_button_component.click(
266
  fn=process,
 
41
  return image
42
 
43
 
44
+ EXAMPLES = [
45
+ [
46
+ None,
47
+ {
48
+ "background": Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-image.png", stream=True).raw),
49
+ "layers": [remove_background(Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-mask-2.png", stream=True).raw))],
50
+ "composite": Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-composite-2.png", stream=True).raw),
51
+ },
52
+ "little lion",
53
+ None,
54
+ 42,
55
+ False,
56
+ 0.85,
57
+ 30
58
+ ],
59
+ [
60
+ None,
61
+ {
62
+ "background": Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-image.png", stream=True).raw),
63
+ "layers": [remove_background(Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-mask-3.png", stream=True).raw))],
64
+ "composite": Image.open(requests.get("https://media.roboflow.com/spaces/doge-2-composite-3.png", stream=True).raw),
65
+ },
66
+ "tattoos",
67
+ None,
68
+ 42,
69
+ False,
70
+ 0.85,
71
+ 30
72
+ ]
73
+ ]
74
 
75
  pipe = FluxInpaintPipeline.from_pretrained(
76
  "black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16).to(DEVICE)
 
240
  with gr.Accordion("Debug", open=False):
241
  output_mask_component = gr.Image(
242
  type='pil', image_mode='RGB', label='Input mask', format="png")
243
+ with gr.Row():
244
+ gr.Examples(
245
+ fn=process,
246
+ examples=EXAMPLES,
247
+ inputs=[
248
+ input_image_editor_component,
249
+ inpainting_prompt_text_component,
250
+ masking_prompt_text_component,
251
+ masking_prompt_text_component,
252
+ seed_slicer_component,
253
+ randomize_seed_checkbox_component,
254
+ strength_slider_component,
255
+ num_inference_steps_slider_component
256
+ ],
257
+ outputs=[
258
+ output_image_component,
259
+ output_mask_component
260
+ ],
261
+ run_on_click=True,
262
+ cache_examples=True
263
+ )
264
 
265
  submit_button_component.click(
266
  fn=process,