Spaces:
Runtime error
Runtime error
File size: 617 Bytes
ae57cbd ee55e62 dd6f3b1 299518a ee55e62 47d14b5 0721f02 47d14b5 5a18b57 47d14b5 5a18b57 e21963f 6a8394e 2d79b6c 299518a fa3b5b1 5a18b57 fa3b5b1 47d14b5 ae57cbd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import gradio as gr
import random as rd
rand = rd.randint(0,9)
#ch = []
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 หมายเลข')
#ch.append(str(i))
with gr.Column(scale=1):
out = gr.Textbox(label='ผลลัพธ์')
inp.change(guess,inp,out)
myApp.launch() |