File size: 750 Bytes
10f8fbb
 
73bec9f
 
 
 
 
 
 
 
 
 
10f8fbb
 
 
 
73bec9f
10f8fbb
73bec9f
 
 
10f8fbb
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import  gradio as gr
import  random as rd
rand=rd.randint(0,7)
def guess(num):
    num=int(num)
    if unm==rand:
        r='ท้ายถูกเเล้ว'
    else:
        r='ลองกดดูใหม่นะ'
    returu r
def answer():   
    return'เลขที่สุ่มได้คือ'+str(rand)
with gr.Blocks() as myApp:
  with gr.Row():
      with gr.Column(scale=1):
          inp=gr.Radio(choices=list(range(10)),ladel='เลือก1หมายเลข')
          btn=gr.Button(value="เฉลย")
      with gr.Column(scale=1):
            out=gr.Textbox(ladel='ผลลัพธ์')
          inp.chage(guess,inp,out)
          btn.click(fr=answr,outputs,out)
myApp.launch()