Update app.py
Browse files
app.py
CHANGED
@@ -13,15 +13,19 @@ def guess(num):
|
|
13 |
|
14 |
def answer():
|
15 |
return str(rand)
|
|
|
|
|
16 |
|
17 |
with gr.Blocks() as myApp:
|
18 |
with gr.Row():
|
19 |
with gr.Column(scale=1):
|
20 |
inp = gr.Radio(choices=list(range(10)),label='เลือก 1 หมายเลข')
|
21 |
btn = gr.Button(value="เฉลย")
|
|
|
22 |
with gr.Column(scale=1):
|
23 |
out = gr.Textbox(label='ผลลัพธ์')
|
24 |
|
25 |
inp.change(guess,inp,out)
|
26 |
btn.click(fn=answer,outputs=out)
|
|
|
27 |
myApp.launch()
|
|
|
13 |
|
14 |
def answer():
|
15 |
return str(rand)
|
16 |
+
def newRand():
|
17 |
+
rand = rd.randint(0,9)
|
18 |
|
19 |
with gr.Blocks() as myApp:
|
20 |
with gr.Row():
|
21 |
with gr.Column(scale=1):
|
22 |
inp = gr.Radio(choices=list(range(10)),label='เลือก 1 หมายเลข')
|
23 |
btn = gr.Button(value="เฉลย")
|
24 |
+
btn2 = gr.Button(value="สุ่มใหม่")
|
25 |
with gr.Column(scale=1):
|
26 |
out = gr.Textbox(label='ผลลัพธ์')
|
27 |
|
28 |
inp.change(guess,inp,out)
|
29 |
btn.click(fn=answer,outputs=out)
|
30 |
+
btn2.click(fn=newRand)
|
31 |
myApp.launch()
|