jordonpeter01 commited on
Commit
6162b90
·
1 Parent(s): 19f1f7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,14 +1,14 @@
1
- from gradio import Interface
2
 
3
  def rainbow_game(color_choice):
4
  rainbow_colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet", "pink"]
5
 
 
6
  if color_choice.lower() in rainbow_colors:
7
  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>"
8
- else:
9
- 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>"
10
 
11
  return response
12
 
13
- iface = Interface(rainbow_game, "text", "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!")
 
14
  iface.launch()
 
1
+ from gradio import Interface, Dropdown
2
 
3
  def rainbow_game(color_choice):
4
  rainbow_colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet", "pink"]
5
 
6
+ response = ""
7
  if color_choice.lower() in rainbow_colors:
8
  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>"
 
 
9
 
10
  return response
11
 
12
+ color_dropdown = Dropdown(choices=["Select a color"] + rainbow_colors, label="Choose a color")
13
+ 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")
14
  iface.launch()