File size: 777 Bytes
d22c191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr

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

def rainbow_game(color_choice):
    response = ""
    if color_choice.lower() in rainbow_colors:
        response = f"Great choice! {color_choice.capitalize()} is a beautiful color of the rainbow. Let's add it to our masterpiece!"
    else:
        response = "Oh, that's not a rainbow color. Please choose a color from the rainbow."

    return response

iface = gr.Interface(fn=rainbow_game, inputs=gr.Dropdown(choices=rainbow_colors, label="Choose a color"),
                     outputs="text", live=True, title="Rainbow Game",
                     description="Choose a color from the rainbow and let's create a colorful masterpiece together!")
iface.launch()