File size: 556 Bytes
09f2fa3
 
ab7c97f
 
 
 
 
 
 
60df828
09f2fa3
 
 
 
 
3a97f15
ab7c97f
c4598f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
import random as rd
rand =rd.randint(1,4)
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()