Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -4,19 +4,19 @@ rand = rd.randint(0,9)
|
|
4 |
def guess(num):
|
5 |
num = int(num)
|
6 |
if num == rand:
|
7 |
-
r = '
|
8 |
else:
|
9 |
-
r = '
|
10 |
return r
|
11 |
def answer():
|
12 |
-
return '
|
13 |
with gr.Blocks() as myApp:
|
14 |
with gr.Row():
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
myApp.launch()
|
|
|
4 |
def guess(num):
|
5 |
num = int(num)
|
6 |
if num == rand:
|
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()
|