Spaces:
Runtime error
Runtime error
RamAnanth1
commited on
Commit
•
2105a5f
1
Parent(s):
c261a40
Delete app_hed.py
Browse files- app_hed.py +0 -83
app_hed.py
DELETED
@@ -1,83 +0,0 @@
|
|
1 |
-
# This file is adapted from https://github.com/lllyasviel/ControlNet/blob/f4748e3630d8141d7765e2bd9b1e348f47847707/gradio_hed2image.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 HED 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 |
-
num_samples = gr.Slider(label='Images',
|
17 |
-
minimum=1,
|
18 |
-
maximum=max_images,
|
19 |
-
value=default_num_images,
|
20 |
-
step=1)
|
21 |
-
image_resolution = gr.Slider(label='Image Resolution',
|
22 |
-
minimum=256,
|
23 |
-
maximum=512,
|
24 |
-
value=512,
|
25 |
-
step=256)
|
26 |
-
detect_resolution = gr.Slider(label='HED Resolution',
|
27 |
-
minimum=128,
|
28 |
-
maximum=512,
|
29 |
-
value=512,
|
30 |
-
step=1)
|
31 |
-
num_steps = gr.Slider(label='Steps',
|
32 |
-
minimum=1,
|
33 |
-
maximum=100,
|
34 |
-
value=20,
|
35 |
-
step=1)
|
36 |
-
guidance_scale = gr.Slider(label='Guidance Scale',
|
37 |
-
minimum=0.1,
|
38 |
-
maximum=30.0,
|
39 |
-
value=9.0,
|
40 |
-
step=0.1)
|
41 |
-
seed = gr.Slider(label='Seed',
|
42 |
-
minimum=-1,
|
43 |
-
maximum=2147483647,
|
44 |
-
step=1,
|
45 |
-
randomize=True)
|
46 |
-
a_prompt = gr.Textbox(
|
47 |
-
label='Added Prompt',
|
48 |
-
value='best quality, extremely detailed')
|
49 |
-
n_prompt = gr.Textbox(
|
50 |
-
label='Negative Prompt',
|
51 |
-
value=
|
52 |
-
'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'
|
53 |
-
)
|
54 |
-
with gr.Column():
|
55 |
-
result = gr.Gallery(label='Output',
|
56 |
-
show_label=False,
|
57 |
-
elem_id='gallery').style(grid=2,
|
58 |
-
height='auto')
|
59 |
-
inputs = [
|
60 |
-
input_image,
|
61 |
-
prompt,
|
62 |
-
a_prompt,
|
63 |
-
n_prompt,
|
64 |
-
num_samples,
|
65 |
-
image_resolution,
|
66 |
-
detect_resolution,
|
67 |
-
num_steps,
|
68 |
-
guidance_scale,
|
69 |
-
seed,
|
70 |
-
]
|
71 |
-
prompt.submit(fn=process, inputs=inputs, outputs=result)
|
72 |
-
run_button.click(fn=process,
|
73 |
-
inputs=inputs,
|
74 |
-
outputs=result,
|
75 |
-
api_name='hed')
|
76 |
-
return demo
|
77 |
-
|
78 |
-
|
79 |
-
if __name__ == '__main__':
|
80 |
-
from model import Model
|
81 |
-
model = Model()
|
82 |
-
demo = create_demo(model.process_hed)
|
83 |
-
demo.queue().launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|