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