fffiloni commited on
Commit
5ac782b
·
1 Parent(s): ec2ffe7

Delete gradio_scribble2image_interactive.py

Browse files
gradio_scribble2image_interactive.py DELETED
@@ -1,90 +0,0 @@
1
- # This file is adapted from https://github.com/lllyasviel/ControlNet/blob/f4748e3630d8141d7765e2bd9b1e348f47847707/gradio_scribble2image_interactive.py
2
- # The original license file is LICENSE.ControlNet in this repo.
3
- import gradio as gr
4
- import numpy as np
5
-
6
-
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, max_images=12):
12
- with gr.Blocks() as demo:
13
- with gr.Row():
14
- gr.Markdown(
15
- '## Control Stable Diffusion with Interactive Scribbles')
16
- with gr.Row():
17
- with gr.Column():
18
- canvas_width = gr.Slider(label='Canvas Width',
19
- minimum=256,
20
- maximum=1024,
21
- value=512,
22
- step=1)
23
- canvas_height = gr.Slider(label='Canvas Height',
24
- minimum=256,
25
- maximum=1024,
26
- value=512,
27
- step=1)
28
- create_button = gr.Button(label='Start',
29
- value='Open drawing canvas!')
30
- input_image = gr.Image(source='upload',
31
- type='numpy',
32
- tool='sketch')
33
- gr.Markdown(
34
- value=
35
- 'Do not forget to change your brush width to make it thinner. (Gradio do not allow developers to set brush width so you need to do it manually.) '
36
- 'Just click on the small pencil icon in the upper right corner of the above block.'
37
- )
38
- create_button.click(fn=create_canvas,
39
- inputs=[canvas_width, canvas_height],
40
- outputs=[input_image],
41
- queue=False)
42
- prompt = gr.Textbox(label='Prompt')
43
- run_button = gr.Button(label='Run')
44
- with gr.Accordion('Advanced options', open=False):
45
- num_samples = gr.Slider(label='Images',
46
- minimum=1,
47
- maximum=max_images,
48
- value=1,
49
- step=1)
50
- image_resolution = gr.Slider(label='Image Resolution',
51
- minimum=256,
52
- maximum=768,
53
- value=512,
54
- step=256)
55
- ddim_steps = gr.Slider(label='Steps',
56
- minimum=1,
57
- maximum=100,
58
- value=20,
59
- step=1)
60
- scale = gr.Slider(label='Guidance Scale',
61
- minimum=0.1,
62
- maximum=30.0,
63
- value=9.0,
64
- step=0.1)
65
- seed = gr.Slider(label='Seed',
66
- minimum=-1,
67
- maximum=2147483647,
68
- step=1,
69
- randomize=True,
70
- queue=False)
71
- eta = gr.Number(label='eta (DDIM)', value=0.0)
72
- a_prompt = gr.Textbox(
73
- label='Added Prompt',
74
- value='best quality, extremely detailed')
75
- n_prompt = gr.Textbox(
76
- label='Negative Prompt',
77
- value=
78
- 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'
79
- )
80
- with gr.Column():
81
- result_gallery = gr.Gallery(label='Output',
82
- show_label=False,
83
- elem_id='gallery').style(
84
- grid=2, height='auto')
85
- ips = [
86
- input_image, prompt, a_prompt, n_prompt, num_samples,
87
- image_resolution, ddim_steps, scale, seed, eta
88
- ]
89
- run_button.click(fn=process, inputs=ips, outputs=[result_gallery])
90
- return demo