sonobit commited on
Commit
0732dce
1 Parent(s): 389d62d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -8,11 +8,17 @@ def guess(num):
8
  else:
9
  r = 'ลองกดใหม่นะ'
10
  return r
 
 
 
 
11
  with gr.Blocks() as myApp:
12
  with gr.Row():
13
  with gr.Column(scale=1):
14
  inp = gr.Radio(choices=list(range(10)),label='เลือก 1 หมายเลข')
 
15
  with gr.Column(scale=1):
16
  out = gr.Textbox(label='ผลลัพธ์')
17
- inp.change(guess,inp,out)
 
18
  myApp.launch()
 
8
  else:
9
  r = 'ลองกดใหม่นะ'
10
  return r
11
+
12
+ def answer():
13
+ return 'เลขที่สุ่มได้คือ '+str(rand)
14
+
15
  with gr.Blocks() as myApp:
16
  with gr.Row():
17
  with gr.Column(scale=1):
18
  inp = gr.Radio(choices=list(range(10)),label='เลือก 1 หมายเลข')
19
+ btn = gr.Button(value="เฉลย")
20
  with gr.Column(scale=1):
21
  out = gr.Textbox(label='ผลลัพธ์')
22
+ inp.change(guess,inp,out)
23
+ btn.click(fn=answer,outputs=out)
24
  myApp.launch()