Drawing_lots / app.py
JM0410's picture
Create app.py
15b7f22 verified
Raw History Blame Contribute Delete
764 Bytes
import random
import gradio as gr
def ladder_game(participants, outcomes):
if len(participants) != len(outcomes):
return "The number of participants must be equal to the number of outcomes."
random.shuffle(outcomes)
results = dict(zip(participants, outcomes))
return results
def gradio_ladder_game():
participants = ["Team 1", "Team 2", "Team 3", "Team 4"]
outcomes = ["love", "robot", "storm", "death"]
results = ladder_game(participants, outcomes)
return results
iface = gr.Interface(
fn=gradio_ladder_game,
inputs=None,
outputs="json",
title="Drawing lots!🌱",
description="Each team (Team 1, Team 2, Team 3, Team 4) will get one of the outcomes: love, robot, storm, death."
)
iface.launch()