RamAnanth1 commited on
Commit
1f955e8
·
1 Parent(s): 6c2f5c1

Delete app_seg.py

Browse files
Files changed (1) hide show
  1. app_seg.py +0 -87
app_seg.py DELETED
@@ -1,87 +0,0 @@
1
- # This file is adapted from https://github.com/lllyasviel/ControlNet/blob/f4748e3630d8141d7765e2bd9b1e348f47847707/gradio_seg2image.py
2
- # The original license file is LICENSE.ControlNet in this repo.
3
- import gradio as gr
4
-
5
-
6
- def create_demo(process, max_images=12, default_num_images=3):
7
- with gr.Blocks() as demo:
8
- with gr.Row():
9
- gr.Markdown('## Control Stable Diffusion with Segmentation Maps')
10
- with gr.Row():
11
- with gr.Column():
12
- input_image = gr.Image(source='upload', type='numpy')
13
- prompt = gr.Textbox(label='Prompt')
14
- run_button = gr.Button(label='Run')
15
- with gr.Accordion('Advanced options', open=False):
16
- is_segmentation_map = gr.Checkbox(
17
- label='Is segmentation map', value=False)
18
- num_samples = gr.Slider(label='Images',
19
- minimum=1,
20
- maximum=max_images,
21
- value=default_num_images,
22
- step=1)
23
- image_resolution = gr.Slider(label='Image Resolution',
24
- minimum=256,
25
- maximum=512,
26
- value=512,
27
- step=256)
28
- detect_resolution = gr.Slider(
29
- label='Segmentation Resolution',
30
- minimum=128,
31
- maximum=512,
32
- value=512,
33
- step=1)
34
- num_steps = gr.Slider(label='Steps',
35
- minimum=1,
36
- maximum=100,
37
- value=20,
38
- step=1)
39
- guidance_scale = gr.Slider(label='Guidance Scale',
40
- minimum=0.1,
41
- maximum=30.0,
42
- value=9.0,
43
- step=0.1)
44
- seed = gr.Slider(label='Seed',
45
- minimum=-1,
46
- maximum=2147483647,
47
- step=1,
48
- randomize=True)
49
- a_prompt = gr.Textbox(
50
- label='Added Prompt',
51
- value='best quality, extremely detailed')
52
- n_prompt = gr.Textbox(
53
- label='Negative Prompt',
54
- value=
55
- 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'
56
- )
57
- with gr.Column():
58
- result = gr.Gallery(label='Output',
59
- show_label=False,
60
- elem_id='gallery').style(grid=2,
61
- height='auto')
62
- inputs = [
63
- input_image,
64
- prompt,
65
- a_prompt,
66
- n_prompt,
67
- num_samples,
68
- image_resolution,
69
- detect_resolution,
70
- num_steps,
71
- guidance_scale,
72
- seed,
73
- is_segmentation_map,
74
- ]
75
- prompt.submit(fn=process, inputs=inputs, outputs=result)
76
- run_button.click(fn=process,
77
- inputs=inputs,
78
- outputs=result,
79
- api_name='seg')
80
- return demo
81
-
82
-
83
- if __name__ == '__main__':
84
- from model import Model
85
- model = Model()
86
- demo = create_demo(model.process_seg)
87
- demo.queue().launch()