File size: 1,008 Bytes
6162b90
9ffd69a
9bf6b27
 
4ad8c78
6162b90
4ad8c78
 
9bf6b27
 
9ffd69a
77fab30
 
9bf6b27
4ad8c78
fdaa29c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from gradio import Interface, Dropdown

rainbow_colors = ["Select a color", "red", "orange", "yellow", "green", "blue", "indigo", "violet", "pink"]

def rainbow_game(color_choice):
    response = ""
    if color_choice.lower() in rainbow_colors:
        response = f"<p style='color:{color_choice}; font-size:18px;'>Great choice, my love! {color_choice.capitalize()} is a beautiful color of the rainbow. Let's add it to our masterpiece!</p>"
    else:
        response = "<p style='color:white; font-size:18px; background-color:black;'>Oh, my dear Pedro, that's not a rainbow color. Please choose a color from the rainbow.</p>"

    return response

color_dropdown = Dropdown(choices=rainbow_colors, label="Choose a color")
iface = Interface(rainbow_game, inputs=color_dropdown, outputs="html", live=True, live_port=8001, live_width=800, live_height=400, title="Rainbow Game 🌈", description="Choose a color from the rainbow and let's create a colorful masterpiece together!", btn="Submit")
iface.launch()