alexmac93 commited on
Commit
3d5ee93
·
verified ·
1 Parent(s): ef57e1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -1,17 +1,15 @@
1
- import random
2
  import gradio as gr
 
3
 
4
- def roll_dice(sides):
5
  return random.randint(1, sides)
6
 
7
- # Create the Gradio interface
8
- iface = gr.Interface(
9
- fn=roll_dice,
10
- inputs=gr.Number(label="Number of Sides (2-100)", value=6, precision=0),
11
- outputs="number",
12
  title="Dice Roller",
13
- description="Enter the number of sides on the dice and click 'Submit' to roll!"
14
  )
15
 
16
- # Launch the app
17
- iface.launch()
 
 
1
  import gradio as gr
2
+ import random
3
 
4
+ def roll_dice(sides=6):
5
  return random.randint(1, sides)
6
 
7
+ demo = gr.Interface(
8
+ fn=roll_dice,
9
+ inputs=gr.Number(value=6, label="Number of Sides"),
10
+ outputs="text",
 
11
  title="Dice Roller",
12
+ description="Enter the number of sides for the dice and get the roll result."
13
  )
14
 
15
+ demo.launch()