generated from society-ai/simple-image-gen
Update app.py
All checks were successful
society-ai-hub-container-cache Actions Demo / build (push) Successful in 26s
All checks were successful
society-ai-hub-container-cache Actions Demo / build (push) Successful in 26s
This commit is contained in:
parent
f91145900b
commit
cb93ffe7ec
13
app.py
13
app.py
@ -15,6 +15,7 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
|
||||
gr.Markdown("## FLUX.1-schnell Image Generation")
|
||||
|
||||
# Dropdown menus
|
||||
gender = gr.Dropdown(label="Gender", choices=["Male", "Female"], value="Male")
|
||||
avatar = gr.Dropdown(label="Avatar", choices=["Wizard", "Cyborg", "Clown", "Samurai"], value="Wizard")
|
||||
hair = gr.Dropdown(label="Hair", choices=["Long", "Short", "Mohawk", "Ponytail"], value="Long")
|
||||
theme = gr.Dropdown(label="Theme", choices=["Cyberpunk", "Fantasy", "Anime", "Dreamscape"], value="Cyberpunk")
|
||||
@ -23,9 +24,9 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
|
||||
# Checkbox for randomize seed
|
||||
randomize_seed = gr.Checkbox(label="Randomize Seed", value=True)
|
||||
|
||||
# Fixed parameters
|
||||
width = 256
|
||||
height = 256
|
||||
# Adjusted parameters
|
||||
width = 512
|
||||
height = 512
|
||||
num_steps = 4
|
||||
guidance_scale = 7.5
|
||||
fixed_seed = 123
|
||||
@ -34,9 +35,9 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
|
||||
output_image = gr.Image(type="numpy", label="Generated Image")
|
||||
message = gr.Textbox(label="Status", interactive=False)
|
||||
|
||||
def generate_image(avatar, hair, theme, color, randomize_seed):
|
||||
def generate_image(gender, avatar, hair, theme, color, randomize_seed):
|
||||
# Construct the prompt
|
||||
prompt = f"image of a {avatar} with {hair} hair, in a {theme} style with {color} as the main color"
|
||||
prompt = f"image of a {gender} {avatar} with {hair} hair, in a {theme} style with {color} as the main color"
|
||||
|
||||
# Seed logic
|
||||
seed = random.randint(0, MAX_SEED) if randomize_seed else fixed_seed
|
||||
@ -133,7 +134,7 @@ with gr.Blocks(css="footer {visibility: hidden}") as demo:
|
||||
|
||||
generate_button.click(
|
||||
generate_image,
|
||||
inputs=[avatar, hair, theme, color, randomize_seed],
|
||||
inputs=[gender, avatar, hair, theme, color, randomize_seed],
|
||||
outputs=[output_image, message]
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user