hysts HF staff radames HF staff commited on
Commit
ca01e24
1 Parent(s): 8e14a04

limit max number of images (#2)

Browse files

- limit max number of images (e3991bb3aa63c7ab6ada87407864ca7dd31d68bd)


Co-authored-by: Radamés Ajna <radames@users.noreply.huggingface.co>

app.py CHANGED
@@ -36,6 +36,7 @@ from gradio_scribble2image_interactive import \
36
  from gradio_seg2image import create_demo as create_demo_seg
37
  from model import Model
38
 
 
39
  DESCRIPTION = '''# ControlNet
40
 
41
  This is an unofficial demo for [https://github.com/lllyasviel/ControlNet](https://github.com/lllyasviel/ControlNet).
@@ -53,25 +54,25 @@ with gr.Blocks(css='style.css') as demo:
53
  gr.Markdown(DESCRIPTION)
54
  with gr.Tabs():
55
  with gr.TabItem('Canny'):
56
- create_demo_canny(model.process_canny)
57
  with gr.TabItem('Hough'):
58
- create_demo_hough(model.process_hough)
59
  with gr.TabItem('HED'):
60
- create_demo_hed(model.process_hed)
61
  with gr.TabItem('Scribble'):
62
- create_demo_scribble(model.process_scribble)
63
  with gr.TabItem('Scribble Interactive'):
64
  create_demo_scribble_interactive(
65
- model.process_scribble_interactive)
66
  with gr.TabItem('Fake Scribble'):
67
- create_demo_fake_scribble(model.process_fake_scribble)
68
  with gr.TabItem('Pose'):
69
- create_demo_pose(model.process_pose)
70
  with gr.TabItem('Segmentation'):
71
- create_demo_seg(model.process_seg)
72
  with gr.TabItem('Depth'):
73
- create_demo_depth(model.process_depth)
74
  with gr.TabItem('Normal map'):
75
- create_demo_normal(model.process_normal)
76
 
77
  demo.queue(api_open=False).launch()
 
36
  from gradio_seg2image import create_demo as create_demo_seg
37
  from model import Model
38
 
39
+ MAX_IMAGES = 1
40
  DESCRIPTION = '''# ControlNet
41
 
42
  This is an unofficial demo for [https://github.com/lllyasviel/ControlNet](https://github.com/lllyasviel/ControlNet).
 
54
  gr.Markdown(DESCRIPTION)
55
  with gr.Tabs():
56
  with gr.TabItem('Canny'):
57
+ create_demo_canny(model.process_canny, max_images=MAX_IMAGES)
58
  with gr.TabItem('Hough'):
59
+ create_demo_hough(model.process_hough, max_images=MAX_IMAGES)
60
  with gr.TabItem('HED'):
61
+ create_demo_hed(model.process_hed, max_images=MAX_IMAGES)
62
  with gr.TabItem('Scribble'):
63
+ create_demo_scribble(model.process_scribble, max_images=MAX_IMAGES)
64
  with gr.TabItem('Scribble Interactive'):
65
  create_demo_scribble_interactive(
66
+ model.process_scribble_interactive, max_images=MAX_IMAGES)
67
  with gr.TabItem('Fake Scribble'):
68
+ create_demo_fake_scribble(model.process_fake_scribble, max_images=MAX_IMAGES)
69
  with gr.TabItem('Pose'):
70
+ create_demo_pose(model.process_pose, max_images=MAX_IMAGES)
71
  with gr.TabItem('Segmentation'):
72
+ create_demo_seg(model.process_seg, max_images=MAX_IMAGES)
73
  with gr.TabItem('Depth'):
74
+ create_demo_depth(model.process_depth, max_images=MAX_IMAGES)
75
  with gr.TabItem('Normal map'):
76
+ create_demo_normal(model.process_normal, max_images=MAX_IMAGES)
77
 
78
  demo.queue(api_open=False).launch()
gradio_canny2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Canny Edge Maps')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Canny Edge Maps')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
gradio_depth2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Depth Maps')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Depth Maps')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
gradio_fake_scribble2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Fake Scribble Maps')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Fake Scribble Maps')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
gradio_hed2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with HED Maps')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with HED Maps')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
gradio_hough2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Hough Line Maps')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Hough Line Maps')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
gradio_normal2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Normal Maps')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Normal Maps')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
gradio_pose2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Human Pose')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Human Pose')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
gradio_scribble2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Scribble Maps')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Scribble Maps')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
gradio_scribble2image_interactive.py CHANGED
@@ -8,7 +8,7 @@ def create_canvas(w, h):
8
  return np.zeros(shape=(h, w, 3), dtype=np.uint8) + 255
9
 
10
 
11
- def create_demo(process):
12
  with gr.Blocks() as demo:
13
  with gr.Row():
14
  gr.Markdown(
@@ -43,7 +43,7 @@ def create_demo(process):
43
  with gr.Accordion('Advanced options', open=False):
44
  num_samples = gr.Slider(label='Images',
45
  minimum=1,
46
- maximum=12,
47
  value=1,
48
  step=1)
49
  image_resolution = gr.Slider(label='Image Resolution',
 
8
  return np.zeros(shape=(h, w, 3), dtype=np.uint8) + 255
9
 
10
 
11
+ def create_demo(process, max_images=12):
12
  with gr.Blocks() as demo:
13
  with gr.Row():
14
  gr.Markdown(
 
43
  with gr.Accordion('Advanced options', open=False):
44
  num_samples = gr.Slider(label='Images',
45
  minimum=1,
46
+ maximum=max_images,
47
  value=1,
48
  step=1)
49
  image_resolution = gr.Slider(label='Image Resolution',
gradio_seg2image.py CHANGED
@@ -3,7 +3,7 @@
3
  import gradio as gr
4
 
5
 
6
- def create_demo(process):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Segmentation Maps')
@@ -15,7 +15,7 @@ def create_demo(process):
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
- maximum=12,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',
 
3
  import gradio as gr
4
 
5
 
6
+ def create_demo(process, max_images=12):
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
  gr.Markdown('## Control Stable Diffusion with Segmentation Maps')
 
15
  with gr.Accordion('Advanced options', open=False):
16
  num_samples = gr.Slider(label='Images',
17
  minimum=1,
18
+ maximum=max_images,
19
  value=1,
20
  step=1)
21
  image_resolution = gr.Slider(label='Image Resolution',