File size: 591 Bytes
0412cee
e6760d9
0412cee
 
 
 
 
0a4e7a7
0412cee
 
 
 
5632675
7ed92a3
5632675
a6b6567
 
0412cee
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
import random  as rd
rand = rd.randint(0,9)
def guess(num):
    num = int(num)
    if num ==rand:
        r = 'ทายถูกเเล้ว'
    else:
        r = 'ลองกดใหม่นะ'
    return r
with gr.Blocks() as myApp:
    with gr.Row():
        with gr.Column(scale=1):
            inp = gr.Radio(choices=list(range(10)),label='เลือก 1 หมายเลข')
        with gr.Column(scale=1):
            out = gr.Textbox(label='ผลลับธ์')
        inp.change(guess,inp,out)
myApp.launch