Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import random as rd
|
| 3 |
|
| 4 |
-
rand =
|
|
|
|
| 5 |
|
| 6 |
def guess(num):
|
| 7 |
num = int(num)
|
| 8 |
-
if num == rand:
|
| 9 |
r = 'ทายถูกแล้ว'
|
| 10 |
else:
|
| 11 |
r = 'ลองกดใหม่นะ'
|
|
@@ -15,9 +16,8 @@ def answer():
|
|
| 15 |
return str(rand)
|
| 16 |
|
| 17 |
with gr.Blocks() as myApp:
|
| 18 |
-
rand = rd.randint(0,9)
|
| 19 |
def newRand():
|
| 20 |
-
rand
|
| 21 |
return str(rand)
|
| 22 |
with gr.Row():
|
| 23 |
with gr.Column(scale=1):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random as rd
|
| 3 |
|
| 4 |
+
rand = []
|
| 5 |
+
rand.append(rd.randint(0,9))
|
| 6 |
|
| 7 |
def guess(num):
|
| 8 |
num = int(num)
|
| 9 |
+
if num == rand[0]:
|
| 10 |
r = 'ทายถูกแล้ว'
|
| 11 |
else:
|
| 12 |
r = 'ลองกดใหม่นะ'
|
|
|
|
| 16 |
return str(rand)
|
| 17 |
|
| 18 |
with gr.Blocks() as myApp:
|
|
|
|
| 19 |
def newRand():
|
| 20 |
+
rand[0]= rd.randint(0,9)
|
| 21 |
return str(rand)
|
| 22 |
with gr.Row():
|
| 23 |
with gr.Column(scale=1):
|