sonobit commited on
Commit
5036ffb
·
1 Parent(s): 3a61ef8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -2,9 +2,7 @@ import gradio as gr
2
  import random as rd
3
 
4
  rand = rd.randint(0,9)
5
- def newRand():
6
- rand = rd.randint(0,9)
7
- return ''
8
  def guess(num):
9
  num = int(num)
10
  if num == rand:
@@ -16,6 +14,9 @@ def answer():
16
  return str(rand)
17
 
18
  with gr.Blocks() as myApp:
 
 
 
19
  with gr.Row():
20
  with gr.Column(scale=1):
21
  inp = gr.Radio(choices=list(range(10)),label='เลือก 1 หมายเลข')
@@ -26,5 +27,5 @@ with gr.Blocks() as myApp:
26
 
27
  inp.change(guess,inp,out)
28
  btn.click(fn=answer,outputs=out)
29
- btn2.click(fn=newRand,outputs=out)
30
  myApp.launch()
 
2
  import random as rd
3
 
4
  rand = rd.randint(0,9)
5
+
 
 
6
  def guess(num):
7
  num = int(num)
8
  if num == rand:
 
14
  return str(rand)
15
 
16
  with gr.Blocks() as myApp:
17
+ def newRand():
18
+ rand = rd.randint(0,9)
19
+ return ''
20
  with gr.Row():
21
  with gr.Column(scale=1):
22
  inp = gr.Radio(choices=list(range(10)),label='เลือก 1 หมายเลข')
 
27
 
28
  inp.change(guess,inp,out)
29
  btn.click(fn=answer,outputs=out)
30
+ btn2.click(fn=newRand,inputs=None,outputs=out)
31
  myApp.launch()