|
import gradio as gr |
|
|
|
|
|
def handle_size(selected_size): |
|
""" |
|
Returns a message based on the selected size ratio. |
|
""" |
|
return f"You have selected the size ratio: {selected_size}" |
|
|
|
|
|
def handle_theme(selected_theme): |
|
""" |
|
Returns a message based on the selected theme. |
|
""" |
|
return f"You have selected the theme: {selected_theme}" |
|
|
|
|
|
def reset_selections(): |
|
""" |
|
Resets the size ratio and theme selections to their default values. |
|
""" |
|
return "16:9", "Light", "You have reset to default settings." |
|
|
|
|
|
with gr.Blocks() as demo: |
|
|
|
gr.Markdown("## Welcome to the FLUX Model App") |
|
|
|
|
|
with gr.Row(): |
|
|
|
size_dropdown = gr.Dropdown( |
|
choices=["1:3", "16:9", "4:3", "21:9"], |
|
label="Select Size Ratio", |
|
value="16:9" |
|
) |
|
|
|
|
|
theme_dropdown = gr.Dropdown( |
|
choices=["Light", "Dark"], |
|
label="Select Theme", |
|
value="Light" |
|
) |
|
|
|
|
|
submit_button = gr.Button("Submit") |
|
|
|
|
|
reset_button = gr.Button("Reset to Default") |
|
|
|
|
|
size_output = gr.Textbox(label="Selected Size") |
|
|
|
|
|
theme_output = gr.Textbox(label="Selected Theme") |
|
|
|
|
|
reset_output = gr.Textbox(label="Reset Confirmation") |
|
|
|
|
|
submit_button.click( |
|
fn=lambda size, theme: (handle_size(size), handle_theme(theme)), |
|
inputs=[size_dropdown, theme_dropdown], |
|
outputs=[size_output, theme_output] |
|
) |
|
|
|
|
|
reset_button.click( |
|
fn=reset_selections, |
|
inputs=None, |
|
outputs=[size_dropdown, theme_dropdown, reset_output] |
|
) |
|
|
|
|
|
gr.load("models/black-forest-labs/FLUX.1-dev").launch() |
|
|
|
|
|
demo.launch() |