Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,23 @@
|
|
1 |
import gradio as gr
|
2 |
import random as rd
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
with gr.Blocks() as myApp:
|
5 |
with gr.Row():
|
6 |
with gr.Column(scale=1):
|
7 |
inp=gr.Radio(choices=list(range(10)),ladel='เลือก1หมายเลข')
|
|
|
8 |
with gr.Column(scale=1):
|
9 |
-
|
|
|
|
|
10 |
myApp.launch()
|
11 |
|
|
|
1 |
import gradio as gr
|
2 |
import random as rd
|
3 |
+
rand=rd.randint(0,7)
|
4 |
+
def guess(num):
|
5 |
+
num=int(num)
|
6 |
+
if unm==rand:
|
7 |
+
r='ท้ายถูกเเล้ว'
|
8 |
+
else:
|
9 |
+
r='ลองกดดูใหม่นะ'
|
10 |
+
returu 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)),ladel='เลือก1หมายเลข')
|
17 |
+
btn=gr.Button(value="เฉลย")
|
18 |
with gr.Column(scale=1):
|
19 |
+
out=gr.Textbox(ladel='ผลลัพธ์')
|
20 |
+
inp.chage(guess,inp,out)
|
21 |
+
btn.click(fr=answr,outputs,out)
|
22 |
myApp.launch()
|
23 |
|