unim4er commited on
Commit
c933b28
1 Parent(s): f554b7d

Update app.py

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