Update app.py
Browse files
app.py
CHANGED
|
@@ -263,13 +263,13 @@ def generate_loss_based_image(text_embeddings, seed, max_length):
|
|
| 263 |
|
| 264 |
|
| 265 |
def generate_image_from_prompt(text_in, style_in):
|
| 266 |
-
STYLE_LIST = ['
|
| 267 |
STYLE_SEEDS = [128, 64, 128, 64, 128]
|
| 268 |
|
| 269 |
print(text_in)
|
| 270 |
print(style_in)
|
| 271 |
-
style_file = style_in + '.bin'
|
| 272 |
-
idx = STYLE_LIST.index(
|
| 273 |
print(style_file)
|
| 274 |
print(idx)
|
| 275 |
|
|
@@ -290,26 +290,28 @@ def generate_image_from_prompt(text_in, style_in):
|
|
| 290 |
title = 'Stable Diffusion Art Generator'
|
| 291 |
|
| 292 |
# Add clear and concise labels and instructions
|
| 293 |
-
prompt_label = "
|
| 294 |
styles_label = "Select a Pretrained Style:"
|
| 295 |
|
| 296 |
instructions = "Explore creative art generation using Stable Diffusion. Enter a prompt and choose a style to get started."
|
| 297 |
|
| 298 |
demo = gr.Interface(generate_image_from_prompt,
|
| 299 |
-
inputs
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
|
|
|
|
|
|
|
|
|
| 303 |
),
|
| 304 |
],
|
| 305 |
outputs=[
|
| 306 |
gr.Gallery(label="Generated Images", show_label=False, elem_id="gallery", columns=[2], rows=[2],
|
| 307 |
-
object_fit="contain"),
|
| 308 |
],
|
| 309 |
title=title,
|
| 310 |
description=instructions,
|
| 311 |
theme="compact" # Apply a predefined theme
|
| 312 |
)
|
| 313 |
-
|
| 314 |
|
| 315 |
demo.launch(debug=True)
|
|
|
|
| 263 |
|
| 264 |
|
| 265 |
def generate_image_from_prompt(text_in, style_in):
|
| 266 |
+
STYLE_LIST = ['oil_style.bin', 'valorant_style.bin', 'cartoon_syle.bin', 'space_style.bin', 'terraria_syle.bin']
|
| 267 |
STYLE_SEEDS = [128, 64, 128, 64, 128]
|
| 268 |
|
| 269 |
print(text_in)
|
| 270 |
print(style_in)
|
| 271 |
+
style_file = style_in + '_style.bin'
|
| 272 |
+
idx = STYLE_LIST.index(style_file)
|
| 273 |
print(style_file)
|
| 274 |
print(idx)
|
| 275 |
|
|
|
|
| 290 |
title = 'Stable Diffusion Art Generator'
|
| 291 |
|
| 292 |
# Add clear and concise labels and instructions
|
| 293 |
+
prompt_label = "Enter a prompt (e.g., 'man in style of puppy'):"
|
| 294 |
styles_label = "Select a Pretrained Style:"
|
| 295 |
|
| 296 |
instructions = "Explore creative art generation using Stable Diffusion. Enter a prompt and choose a style to get started."
|
| 297 |
|
| 298 |
demo = gr.Interface(generate_image_from_prompt,
|
| 299 |
+
inputs=[
|
| 300 |
+
gr.Textbox('man in style of puppy', label=prompt_label, style="width: 100%"),
|
| 301 |
+
gr.Dropdown(
|
| 302 |
+
['oil', 'valorant', 'cartoon', 'space', 'terraria'],
|
| 303 |
+
value="valorant",
|
| 304 |
+
label=styles_label,
|
| 305 |
+
style="width: 100%"
|
| 306 |
),
|
| 307 |
],
|
| 308 |
outputs=[
|
| 309 |
gr.Gallery(label="Generated Images", show_label=False, elem_id="gallery", columns=[2], rows=[2],
|
| 310 |
+
object_fit="contain", style="max-width: 800px; margin: 20px auto;"),
|
| 311 |
],
|
| 312 |
title=title,
|
| 313 |
description=instructions,
|
| 314 |
theme="compact" # Apply a predefined theme
|
| 315 |
)
|
|
|
|
| 316 |
|
| 317 |
demo.launch(debug=True)
|