Download app.py from Abhisesh7/Simha__: direct link, hf CLI and curl.
- Browser
- Download file 584 Bytes
-
https://huggingface.co/spaces/Abhisesh7/Simha__/resolve/main/app.py
- Command line
-
hf download hf://spaces/Abhisesh7/Simha__/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Abhisesh7/Simha__/resolve/main/app.py
584 Bytes
| import random | |
| import gradio as gr | |
| def roll_dice(): | |
| p1_roll = random.randint(1, 6) | |
| p2_roll = random.randint(1, 6) | |
| if p1_roll > p2_roll: | |
| winner = "Player 1 wins!" | |
| elif p2_roll > p1_roll: | |
| winner = "Player 2 wins!" | |
| else: | |
| winner = "It's a draw!" | |
| result = f"Player 1 rolled: {p1_roll}\nPlayer 2 rolled: {p2_roll}\n\n{winner}" | |
| return result | |
| iface = gr.Interface( | |
| fn=roll_dice, | |
| inputs=[], | |
| outputs="text", | |
| title="Mini Dice Game", | |
| description="Click the button to roll dice for Player 1 and Player 2" | |
| ) | |
| iface.launch() |