Spaces:
Sleeping
Sleeping
Download app.py from JM0410/Drawing_lots: direct link, hf CLI and curl.
- Browser
- Download file 764 Bytes
-
https://huggingface.co/spaces/JM0410/Drawing_lots/resolve/main/app.py
- Command line
-
hf download hf://spaces/JM0410/Drawing_lots/app.py
-
curl -L -o app.py https://huggingface.co/spaces/JM0410/Drawing_lots/resolve/main/app.py
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() | |