File size: 766 Bytes
180c234 c926d2a 180c234 c926d2a 180c234 c926d2a f1bf15c c926d2a f1bf15c c926d2a f1bf15c 180c234 |
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 |
import gradio as gr
import random
# Define the initial options
options = ["pink"] * 15 + ["blue"] * 10
def spin_roulette():
# Randomly select an option
selected_option = random.choice(options)
# Remove the selected option from the list
options.remove(selected_option)
return selected_option
def draw():
for _ in range(25):
if options:
option = spin_roulette()
if option == "pink":
pink = "images/pink.png"
return pink
else:
blue = "images/blue.png"
return blue
with gr.Blocks() as demo:
result = draw()
draw_btn = gr.Button("Draw")
draw_btn.click(fn=draw, inputs=[], outputs=gr.Image(value=result))
demo.launch()
|