|
import gradio as gr |
|
import random |
|
|
|
|
|
options = ["pink"] * 15 + ["blue"] * 10 |
|
|
|
|
|
def spin_roulette(): |
|
|
|
selected_option = random.choice(options) |
|
|
|
|
|
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() |
|
|