File size: 2,369 Bytes
48206f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import gradio as gr

# Function to handle size selection
def handle_size(selected_size):
    """
    Returns a message based on the selected size ratio.
    """
    return f"You have selected the size ratio: {selected_size}"

# Function to handle theme selection
def handle_theme(selected_theme):
    """
    Returns a message based on the selected theme.
    """
    return f"You have selected the theme: {selected_theme}"

# Function to reset selections to default values
def reset_selections():
    """
    Resets the size ratio and theme selections to their default values.
    """
    return "16:9", "Light", "You have reset to default settings."

# Create a Gradio Blocks interface
with gr.Blocks() as demo:
    # Add a title to the app
    gr.Markdown("## Welcome to the FLUX Model App")

    # Create a row for layout
    with gr.Row():
        # Add a dropdown for size selection
        size_dropdown = gr.Dropdown(
            choices=["1:3", "16:9", "4:3", "21:9"],
            label="Select Size Ratio",
            value="16:9"  # Set a default value
        )

        # Add a dropdown for theme selection
        theme_dropdown = gr.Dropdown(
            choices=["Light", "Dark"],
            label="Select Theme",
            value="Light"  # Set a default value
        )

    # Add a button to confirm selections
    submit_button = gr.Button("Submit")

    # Add a button to reset selections
    reset_button = gr.Button("Reset to Default")

    # Add a textbox to display the selected size
    size_output = gr.Textbox(label="Selected Size")

    # Add a textbox to display the selected theme
    theme_output = gr.Textbox(label="Selected Theme")

    # Add a textbox to display reset confirmation
    reset_output = gr.Textbox(label="Reset Confirmation")

    # Define the action when the submit button is clicked
    submit_button.click(
        fn=lambda size, theme: (handle_size(size), handle_theme(theme)),
        inputs=[size_dropdown, theme_dropdown],
        outputs=[size_output, theme_output]
    )

    # Define the action when the reset button is clicked
    reset_button.click(
        fn=reset_selections,
        inputs=None,
        outputs=[size_dropdown, theme_dropdown, reset_output]
    )

    # Load and launch the FLUX model
    gr.load("models/black-forest-labs/FLUX.1-dev").launch()

# Launch the Gradio app
demo.launch()