|
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() |
|
|