Spaces:
Sleeping
Sleeping
refactor examples (#6)
Browse files- refactor examples (8a1d502cffab31d8451c58a60c151863f723625d)
Co-authored-by: Suraj Patil <valhalla@users.noreply.huggingface.co>
- app_base.py +6 -23
app_base.py
CHANGED
@@ -51,9 +51,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
51 |
def process_example(
|
52 |
image_url: str,
|
53 |
prompt: str,
|
54 |
-
negative_prompt: str,
|
55 |
adapter_name: str,
|
56 |
-
style_name: str,
|
57 |
guidance_scale: float,
|
58 |
adapter_conditioning_scale: float,
|
59 |
seed: int,
|
@@ -63,9 +61,9 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
63 |
return run(
|
64 |
image=image,
|
65 |
prompt=prompt,
|
66 |
-
negative_prompt=
|
67 |
adapter_name=adapter_name,
|
68 |
-
style_name=
|
69 |
guidance_scale=guidance_scale,
|
70 |
adapter_conditioning_scale=adapter_conditioning_scale,
|
71 |
seed=seed,
|
@@ -76,9 +74,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
76 |
[
|
77 |
"assets/org_canny.jpg",
|
78 |
"Mystical fairy in real, magic, 4k picture, high quality",
|
79 |
-
"extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
80 |
"canny",
|
81 |
-
"(No style)",
|
82 |
7.5,
|
83 |
0.75,
|
84 |
42,
|
@@ -87,9 +83,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
87 |
[
|
88 |
"assets/org_sketch.png",
|
89 |
"a robot, mount fuji in the background, 4k photo, highly detailed",
|
90 |
-
"extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
91 |
"sketch",
|
92 |
-
"(No style)",
|
93 |
7.5,
|
94 |
1.0,
|
95 |
42,
|
@@ -98,9 +92,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
98 |
[
|
99 |
"assets/org_lin.jpg",
|
100 |
"Ice dragon roar, 4k photo",
|
101 |
-
"extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
102 |
"lineart",
|
103 |
-
"(No style)",
|
104 |
7.5,
|
105 |
0.8,
|
106 |
42,
|
@@ -109,9 +101,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
109 |
[
|
110 |
"assets/org_mid.jpg",
|
111 |
"A photo of a room, 4k photo, highly detailed",
|
112 |
-
"extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
113 |
"depth-midas",
|
114 |
-
"(No style)",
|
115 |
7.5,
|
116 |
1.0,
|
117 |
42,
|
@@ -120,9 +110,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
120 |
[
|
121 |
"assets/org_zoe.jpg",
|
122 |
"A photo of a orchid, 4k photo, highly detailed",
|
123 |
-
"extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
124 |
"depth-zoe",
|
125 |
-
"(No style)",
|
126 |
5.0,
|
127 |
1.0,
|
128 |
42,
|
@@ -131,9 +119,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
131 |
[
|
132 |
"assets/people.jpg",
|
133 |
"A couple, 4k photo, highly detailed",
|
134 |
-
"extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
135 |
"openpose",
|
136 |
-
"(No style)",
|
137 |
5.0,
|
138 |
1.0,
|
139 |
42,
|
@@ -142,9 +128,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
142 |
[
|
143 |
"assets/depth-midas-image.png",
|
144 |
"stormtrooper lecture, 4k photo, highly detailed",
|
145 |
-
"extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
146 |
"depth-midas",
|
147 |
-
"(No style)",
|
148 |
7.5,
|
149 |
1.0,
|
150 |
42,
|
@@ -153,9 +137,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
153 |
[
|
154 |
"assets/openpose-image.png",
|
155 |
"spiderman, 4k photo, highly detailed",
|
156 |
-
"extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
157 |
"openpose",
|
158 |
-
"(No style)",
|
159 |
5.0,
|
160 |
1.0,
|
161 |
42,
|
@@ -175,7 +157,10 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
175 |
run_button = gr.Button("Run")
|
176 |
with gr.Accordion("Advanced options", open=False):
|
177 |
apply_preprocess = gr.Checkbox(label="Apply preprocess", value=True)
|
178 |
-
negative_prompt = gr.Textbox(
|
|
|
|
|
|
|
179 |
num_inference_steps = gr.Slider(
|
180 |
label="Number of steps",
|
181 |
minimum=1,
|
@@ -221,9 +206,7 @@ def create_demo(model: Model) -> gr.Blocks:
|
|
221 |
inputs=[
|
222 |
image,
|
223 |
prompt,
|
224 |
-
negative_prompt,
|
225 |
adapter_name,
|
226 |
-
style,
|
227 |
guidance_scale,
|
228 |
adapter_conditioning_scale,
|
229 |
seed,
|
|
|
51 |
def process_example(
|
52 |
image_url: str,
|
53 |
prompt: str,
|
|
|
54 |
adapter_name: str,
|
|
|
55 |
guidance_scale: float,
|
56 |
adapter_conditioning_scale: float,
|
57 |
seed: int,
|
|
|
61 |
return run(
|
62 |
image=image,
|
63 |
prompt=prompt,
|
64 |
+
negative_prompt="extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
65 |
adapter_name=adapter_name,
|
66 |
+
style_name="(No style)",
|
67 |
guidance_scale=guidance_scale,
|
68 |
adapter_conditioning_scale=adapter_conditioning_scale,
|
69 |
seed=seed,
|
|
|
74 |
[
|
75 |
"assets/org_canny.jpg",
|
76 |
"Mystical fairy in real, magic, 4k picture, high quality",
|
|
|
77 |
"canny",
|
|
|
78 |
7.5,
|
79 |
0.75,
|
80 |
42,
|
|
|
83 |
[
|
84 |
"assets/org_sketch.png",
|
85 |
"a robot, mount fuji in the background, 4k photo, highly detailed",
|
|
|
86 |
"sketch",
|
|
|
87 |
7.5,
|
88 |
1.0,
|
89 |
42,
|
|
|
92 |
[
|
93 |
"assets/org_lin.jpg",
|
94 |
"Ice dragon roar, 4k photo",
|
|
|
95 |
"lineart",
|
|
|
96 |
7.5,
|
97 |
0.8,
|
98 |
42,
|
|
|
101 |
[
|
102 |
"assets/org_mid.jpg",
|
103 |
"A photo of a room, 4k photo, highly detailed",
|
|
|
104 |
"depth-midas",
|
|
|
105 |
7.5,
|
106 |
1.0,
|
107 |
42,
|
|
|
110 |
[
|
111 |
"assets/org_zoe.jpg",
|
112 |
"A photo of a orchid, 4k photo, highly detailed",
|
|
|
113 |
"depth-zoe",
|
|
|
114 |
5.0,
|
115 |
1.0,
|
116 |
42,
|
|
|
119 |
[
|
120 |
"assets/people.jpg",
|
121 |
"A couple, 4k photo, highly detailed",
|
|
|
122 |
"openpose",
|
|
|
123 |
5.0,
|
124 |
1.0,
|
125 |
42,
|
|
|
128 |
[
|
129 |
"assets/depth-midas-image.png",
|
130 |
"stormtrooper lecture, 4k photo, highly detailed",
|
|
|
131 |
"depth-midas",
|
|
|
132 |
7.5,
|
133 |
1.0,
|
134 |
42,
|
|
|
137 |
[
|
138 |
"assets/openpose-image.png",
|
139 |
"spiderman, 4k photo, highly detailed",
|
|
|
140 |
"openpose",
|
|
|
141 |
5.0,
|
142 |
1.0,
|
143 |
42,
|
|
|
157 |
run_button = gr.Button("Run")
|
158 |
with gr.Accordion("Advanced options", open=False):
|
159 |
apply_preprocess = gr.Checkbox(label="Apply preprocess", value=True)
|
160 |
+
negative_prompt = gr.Textbox(
|
161 |
+
label="Negative prompt",
|
162 |
+
value=" extra digit, fewer digits, cropped, worst quality, low quality, glitch, deformed, mutated, ugly, disfigured",
|
163 |
+
)
|
164 |
num_inference_steps = gr.Slider(
|
165 |
label="Number of steps",
|
166 |
minimum=1,
|
|
|
206 |
inputs=[
|
207 |
image,
|
208 |
prompt,
|
|
|
209 |
adapter_name,
|
|
|
210 |
guidance_scale,
|
211 |
adapter_conditioning_scale,
|
212 |
seed,
|