Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -92,18 +92,6 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
|
|
| 92 |
|
| 93 |
return image
|
| 94 |
|
| 95 |
-
examples = [
|
| 96 |
-
"Dog licking ice cream",
|
| 97 |
-
]
|
| 98 |
-
|
| 99 |
-
# CSS
|
| 100 |
-
'''css="""
|
| 101 |
-
#col-container {
|
| 102 |
-
margin: 0 auto;
|
| 103 |
-
max-width: 520px;
|
| 104 |
-
}
|
| 105 |
-
"""'''
|
| 106 |
-
|
| 107 |
demo = gr.Blocks()
|
| 108 |
|
| 109 |
# Audio translation using microphone as the input
|
|
@@ -194,100 +182,12 @@ num_inference_steps = gr.Slider(
|
|
| 194 |
|
| 195 |
result = gr.Image(label="Result", show_label=False)
|
| 196 |
|
| 197 |
-
'''with gr.Blocks(css=css) as image:
|
| 198 |
-
|
| 199 |
-
with gr.Column(elem_id="col-container"):
|
| 200 |
-
gr.Markdown(f"""
|
| 201 |
-
# Text-to-Image
|
| 202 |
-
Currently running on {power_device}.
|
| 203 |
-
""")
|
| 204 |
-
|
| 205 |
-
with gr.Row():
|
| 206 |
-
|
| 207 |
-
prompt = gr.Text(
|
| 208 |
-
label="Prompt",
|
| 209 |
-
show_label=False,
|
| 210 |
-
max_lines=1,
|
| 211 |
-
placeholder="Enter your prompt",
|
| 212 |
-
container=False,
|
| 213 |
-
)
|
| 214 |
-
|
| 215 |
-
run_button = gr.Button("Run", scale=0)
|
| 216 |
-
|
| 217 |
-
result = gr.Image(label="Result", show_label=False)
|
| 218 |
-
|
| 219 |
-
with gr.Accordion("Advanced Settings", open=False):
|
| 220 |
-
|
| 221 |
-
negative_prompt = gr.Text(
|
| 222 |
-
label="Negative prompt",
|
| 223 |
-
max_lines=1,
|
| 224 |
-
placeholder="Enter a negative prompt",
|
| 225 |
-
visible=False,
|
| 226 |
-
)
|
| 227 |
-
|
| 228 |
-
seed = gr.Slider(
|
| 229 |
-
label="Seed",
|
| 230 |
-
minimum=0,
|
| 231 |
-
maximum=MAX_SEED,
|
| 232 |
-
step=1,
|
| 233 |
-
value=0,
|
| 234 |
-
)
|
| 235 |
-
|
| 236 |
-
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 237 |
-
|
| 238 |
-
with gr.Row():
|
| 239 |
-
|
| 240 |
-
width = gr.Slider(
|
| 241 |
-
label="Width",
|
| 242 |
-
minimum=256,
|
| 243 |
-
maximum=MAX_IMAGE_SIZE,
|
| 244 |
-
step=32,
|
| 245 |
-
value=512,
|
| 246 |
-
)
|
| 247 |
-
|
| 248 |
-
height = gr.Slider(
|
| 249 |
-
label="Height",
|
| 250 |
-
minimum=256,
|
| 251 |
-
maximum=MAX_IMAGE_SIZE,
|
| 252 |
-
step=32,
|
| 253 |
-
value=512,
|
| 254 |
-
)
|
| 255 |
-
|
| 256 |
-
with gr.Row():
|
| 257 |
-
|
| 258 |
-
guidance_scale = gr.Slider(
|
| 259 |
-
label="Guidance scale",
|
| 260 |
-
minimum=0.0,
|
| 261 |
-
maximum=10.0,
|
| 262 |
-
step=0.1,
|
| 263 |
-
value=0.0,
|
| 264 |
-
)
|
| 265 |
-
|
| 266 |
-
num_inference_steps = gr.Slider(
|
| 267 |
-
label="Number of inference steps",
|
| 268 |
-
minimum=1,
|
| 269 |
-
maximum=12,
|
| 270 |
-
step=1,
|
| 271 |
-
value=2,
|
| 272 |
-
)
|
| 273 |
-
|
| 274 |
-
gr.Examples(
|
| 275 |
-
examples = examples,
|
| 276 |
-
inputs = [prompt]
|
| 277 |
-
)
|
| 278 |
-
|
| 279 |
-
run_button.click(
|
| 280 |
-
fn = infer,
|
| 281 |
-
inputs = [prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
| 282 |
-
outputs = [result]
|
| 283 |
-
)
|
| 284 |
-
'''
|
| 285 |
-
|
| 286 |
# Text to Image interface
|
| 287 |
image_generation = gr.Interface(
|
| 288 |
fn=infer,
|
| 289 |
inputs=[prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
| 290 |
outputs=[result],
|
|
|
|
| 291 |
title=title,
|
| 292 |
description=description,
|
| 293 |
)
|
|
|
|
| 92 |
|
| 93 |
return image
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
demo = gr.Blocks()
|
| 96 |
|
| 97 |
# Audio translation using microphone as the input
|
|
|
|
| 182 |
|
| 183 |
result = gr.Image(label="Result", show_label=False)
|
| 184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
# Text to Image interface
|
| 186 |
image_generation = gr.Interface(
|
| 187 |
fn=infer,
|
| 188 |
inputs=[prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
|
| 189 |
outputs=[result],
|
| 190 |
+
examples = ["Dog licking ice cream"]
|
| 191 |
title=title,
|
| 192 |
description=description,
|
| 193 |
)
|