Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,10 +36,10 @@ def ac():
|
|
36 |
else:
|
37 |
v = 0
|
38 |
pass
|
39 |
-
return gr.update(value=0)
|
40 |
def start():
|
41 |
stamp = time.time()
|
42 |
-
return gr.update(value=stamp),gr.update(value=0),None,None,None,None
|
43 |
|
44 |
def end(stamp):
|
45 |
ts = stamp + 6
|
@@ -51,7 +51,7 @@ def ac():
|
|
51 |
print("Passing")
|
52 |
return gr.update(value=0)
|
53 |
|
54 |
-
def im_fn(put,fac="",fac_c
|
55 |
if h == o:
|
56 |
if int(fac_c)==1:
|
57 |
rn = random.randint(0, 19)
|
@@ -59,9 +59,9 @@ def ac():
|
|
59 |
put = f"{put}{fac}"
|
60 |
fac = f"{fac} "
|
61 |
print (rn)
|
62 |
-
return model(put),fac,1
|
63 |
elif int(fac_c)!=1:
|
64 |
-
return None,"",0
|
65 |
elif h != o:
|
66 |
return(None,"",0)
|
67 |
def cl_fac():
|
@@ -77,6 +77,11 @@ def ac():
|
|
77 |
with gr.Row():
|
78 |
out3 = gr.Image()
|
79 |
out4 = gr.Image()
|
|
|
|
|
|
|
|
|
|
|
80 |
with gr.Row(visible=False):
|
81 |
h=gr.Textbox("Q")
|
82 |
t_state=gr.Number()
|
@@ -85,18 +90,15 @@ def ac():
|
|
85 |
fac_c = gr.Textbox(value=0)
|
86 |
fac_d = gr.Textbox(value=1)
|
87 |
|
88 |
-
|
89 |
-
|
90 |
-
#b4=out2.change(im_fn,[put,fac_b,fac_c,h],[out3,fac_b,fac_c])
|
91 |
-
#b5=out3.change(im_fn,[put,fac_b,fac_c,h],[out4,fac_b,fac_c])
|
92 |
-
b1=btn1.click(start,None,[t_state,t_switch,out1,out2,out3,out4,fac_c])
|
93 |
sta = t_state.change(end,t_state,t_switch,every=1)
|
94 |
-
b2=btn1.click(im_fn,[put,fac_b,fac_d,h],[out1,fac_b,fac_c])
|
95 |
b3=out1.change(im_fn,[put,fac_b,fac_c,h],[out2,fac_b,fac_c])
|
96 |
b4=out2.change(im_fn,[put,fac_b,fac_c,h],[out3,fac_b,fac_c])
|
97 |
b5=out3.change(im_fn,[put,fac_b,fac_c,h],[out4,fac_b,fac_c])
|
|
|
98 |
#b0=btn1.click(cl_fac,None,[fac_b,fac_c,out1,out2,out3,out4],show_progress=False)
|
99 |
-
t_switch.change(clear,t_switch,t_switch, cancels=[sta,b2,b3,b4,b5])
|
100 |
|
101 |
b.queue(concurrency_count=100).launch(show_api=False)
|
102 |
ac()
|
|
|
36 |
else:
|
37 |
v = 0
|
38 |
pass
|
39 |
+
return gr.update(value=0),gr.update(value=0)
|
40 |
def start():
|
41 |
stamp = time.time()
|
42 |
+
return gr.update(value=stamp),gr.update(value=0),None,None,None,None
|
43 |
|
44 |
def end(stamp):
|
45 |
ts = stamp + 6
|
|
|
51 |
print("Passing")
|
52 |
return gr.update(value=0)
|
53 |
|
54 |
+
def im_fn(put,fac="",fac_c,h=None):
|
55 |
if h == o:
|
56 |
if int(fac_c)==1:
|
57 |
rn = random.randint(0, 19)
|
|
|
59 |
put = f"{put}{fac}"
|
60 |
fac = f"{fac} "
|
61 |
print (rn)
|
62 |
+
return model(put),fac,gr.update(value=1)
|
63 |
elif int(fac_c)!=1:
|
64 |
+
return None,"",gr.update(value=0)
|
65 |
elif h != o:
|
66 |
return(None,"",0)
|
67 |
def cl_fac():
|
|
|
77 |
with gr.Row():
|
78 |
out3 = gr.Image()
|
79 |
out4 = gr.Image()
|
80 |
+
with gr.Row(visible=False):
|
81 |
+
o1 = gr.Textbox(value=0)
|
82 |
+
o2 = gr.Textbox(value=0)
|
83 |
+
o3 = gr.Textbox(value=0)
|
84 |
+
o4 = gr.Textbox(value=0)
|
85 |
with gr.Row(visible=False):
|
86 |
h=gr.Textbox("Q")
|
87 |
t_state=gr.Number()
|
|
|
90 |
fac_c = gr.Textbox(value=0)
|
91 |
fac_d = gr.Textbox(value=1)
|
92 |
|
93 |
+
|
94 |
+
b1=btn1.click(start,None,[t_state,t_switch,out1,out2,out3,out4])
|
|
|
|
|
|
|
95 |
sta = t_state.change(end,t_state,t_switch,every=1)
|
|
|
96 |
b3=out1.change(im_fn,[put,fac_b,fac_c,h],[out2,fac_b,fac_c])
|
97 |
b4=out2.change(im_fn,[put,fac_b,fac_c,h],[out3,fac_b,fac_c])
|
98 |
b5=out3.change(im_fn,[put,fac_b,fac_c,h],[out4,fac_b,fac_c])
|
99 |
+
b2=btn1.click(im_fn,[put,fac_b,fac_d,h],[out1,fac_b,fac_c])
|
100 |
#b0=btn1.click(cl_fac,None,[fac_b,fac_c,out1,out2,out3,out4],show_progress=False)
|
101 |
+
t_switch.change(clear,t_switch,[t_switch,fac_c], cancels=[sta,b2,b3,b4,b5])
|
102 |
|
103 |
b.queue(concurrency_count=100).launch(show_api=False)
|
104 |
ac()
|