RamAnanth1 commited on
Commit
3e12b41
·
1 Parent(s): c3e9324

Delete app_scribble_interactive.py

Browse files
Files changed (1) hide show
  1. app_scribble_interactive.py +0 -103
app_scribble_interactive.py DELETED
@@ -1,103 +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, default_num_images=3):
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=512,
21
- value=512,
22
- step=1)
23
- canvas_height = gr.Slider(label='Canvas Height',
24
- minimum=256,
25
- maximum=512,
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=default_num_images,
49
- step=1)
50
- image_resolution = gr.Slider(label='Image Resolution',
51
- minimum=256,
52
- maximum=512,
53
- value=512,
54
- step=256)
55
- num_steps = gr.Slider(label='Steps',
56
- minimum=1,
57
- maximum=100,
58
- value=20,
59
- step=1)
60
- guidance_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
- a_prompt = gr.Textbox(
71
- label='Added Prompt',
72
- value='best quality, extremely detailed')
73
- n_prompt = gr.Textbox(
74
- label='Negative Prompt',
75
- value=
76
- 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'
77
- )
78
- with gr.Column():
79
- result = gr.Gallery(label='Output',
80
- show_label=False,
81
- elem_id='gallery').style(grid=2,
82
- height='auto')
83
- inputs = [
84
- input_image,
85
- prompt,
86
- a_prompt,
87
- n_prompt,
88
- num_samples,
89
- image_resolution,
90
- num_steps,
91
- guidance_scale,
92
- seed,
93
- ]
94
- prompt.submit(fn=process, inputs=inputs, outputs=result)
95
- run_button.click(fn=process, inputs=inputs, outputs=result)
96
- return demo
97
-
98
-
99
- if __name__ == '__main__':
100
- from model import Model
101
- model = Model()
102
- demo = create_demo(model.process_scribble_interactive)
103
- demo.queue().launch()