Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import random as rd
|
| 3 |
|
| 4 |
-
|
| 5 |
|
| 6 |
def guess(num,rand):
|
| 7 |
num = int(num)
|
|
@@ -15,7 +15,6 @@ def guess(num,rand):
|
|
| 15 |
def answer():
|
| 16 |
return str(rand)
|
| 17 |
|
| 18 |
-
|
| 19 |
with gr.Blocks() as myApp:
|
| 20 |
rand = rd.randint(0,9)
|
| 21 |
def newRand():
|
|
@@ -29,7 +28,7 @@ with gr.Blocks() as myApp:
|
|
| 29 |
with gr.Column(scale=1):
|
| 30 |
out = gr.Textbox(label='ผลลัพธ์')
|
| 31 |
|
| 32 |
-
inp.change(guess,
|
| 33 |
btn.click(fn=answer,outputs=out)
|
| 34 |
btn2.click(fn=newRand,outputs=out)
|
| 35 |
myApp.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random as rd
|
| 3 |
|
| 4 |
+
rand = -1 #rd.randint(0,9)
|
| 5 |
|
| 6 |
def guess(num,rand):
|
| 7 |
num = int(num)
|
|
|
|
| 15 |
def answer():
|
| 16 |
return str(rand)
|
| 17 |
|
|
|
|
| 18 |
with gr.Blocks() as myApp:
|
| 19 |
rand = rd.randint(0,9)
|
| 20 |
def newRand():
|
|
|
|
| 28 |
with gr.Column(scale=1):
|
| 29 |
out = gr.Textbox(label='ผลลัพธ์')
|
| 30 |
|
| 31 |
+
inp.change(guess,inp,out)
|
| 32 |
btn.click(fn=answer,outputs=out)
|
| 33 |
btn2.click(fn=newRand,outputs=out)
|
| 34 |
myApp.launch()
|