Abhisesh7 commited on
Commit
2c8cb9f
·
verified ·
1 Parent(s): cd2385b

Rename App.py to app.py

Browse files
Files changed (2) hide show
  1. App.py +0 -0
  2. app.py +26 -0
App.py DELETED
File without changes
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import random
2
+ import gradio as gr
3
+
4
+ def roll_dice():
5
+ p1_roll = random.randint(1, 6)
6
+ p2_roll = random.randint(1, 6)
7
+
8
+ if p1_roll > p2_roll:
9
+ winner = "Player 1 wins!"
10
+ elif p2_roll > p1_roll:
11
+ winner = "Player 2 wins!"
12
+ else:
13
+ winner = "It's a draw!"
14
+
15
+ result = f"Player 1 rolled: {p1_roll}\nPlayer 2 rolled: {p2_roll}\n\n{winner}"
16
+ return result
17
+
18
+ iface = gr.Interface(
19
+ fn=roll_dice,
20
+ inputs=[],
21
+ outputs="text",
22
+ title="Mini Dice Game",
23
+ description="Click the button to roll dice for Player 1 and Player 2"
24
+ )
25
+
26
+ iface.launch()