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 elif option == "blue": blue = "images/blue.png" return blue else: pass 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()