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() | |