Update app.py
Browse files
app.py
CHANGED
|
@@ -8,10 +8,15 @@ def guess(num):
|
|
| 8 |
else:
|
| 9 |
r = "ลองกดใหม่นะ"
|
| 10 |
return r
|
| 11 |
-
|
|
|
|
|
|
|
| 12 |
with gr.Row():
|
| 13 |
with gr.Column(scale=1):
|
| 14 |
inp = gr.Radio(Choices=list(range(10)),label='เลือก 1 หมายเลข')
|
|
|
|
| 15 |
with gr.Column(scale=1):
|
| 16 |
out = gr.Textbox(label='ผลลัพธ์')
|
|
|
|
|
|
|
| 17 |
myApp.launch()
|
|
|
|
| 8 |
else:
|
| 9 |
r = "ลองกดใหม่นะ"
|
| 10 |
return r
|
| 11 |
+
def answer():
|
| 12 |
+
return 'เลขที่สุ่มได้ คือ'่+str(rand)
|
| 13 |
+
with gr.Blocks() as myApp.
|
| 14 |
with gr.Row():
|
| 15 |
with gr.Column(scale=1):
|
| 16 |
inp = gr.Radio(Choices=list(range(10)),label='เลือก 1 หมายเลข')
|
| 17 |
+
btn = gr.Button(value='เฉลย')
|
| 18 |
with gr.Column(scale=1):
|
| 19 |
out = gr.Textbox(label='ผลลัพธ์')
|
| 20 |
+
inp.change(guess,inp,out)
|
| 21 |
+
bit.click(fn=answer,outputh=out)
|
| 22 |
myApp.launch()
|