Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -52,20 +52,22 @@ def ac():
|
|
52 |
print("Passing")
|
53 |
pass
|
54 |
return t
|
55 |
-
def im_fn(put,fac="",h=None):
|
56 |
if h == o:
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
65 |
elif h != o:
|
66 |
return(None,"")
|
67 |
def cl_fac():
|
68 |
return "",0,None,None,None,None
|
|
|
69 |
with gr.Blocks() as b:
|
70 |
with gr.Row():
|
71 |
put = gr.Textbox()
|
@@ -85,13 +87,13 @@ def ac():
|
|
85 |
fac_d = gr.Textbox(value=1)
|
86 |
|
87 |
|
88 |
-
|
89 |
b1=btn1.click(start,None,[t_state,t_switch])
|
90 |
sta = t_state.change(end,t_state,t_switch,every=1)
|
91 |
-
b2=btn1.click(im_fn,[put,fac_b,h],[out1,fac_b])
|
92 |
-
b3=out1.change(im_fn,[put,fac_b,h],[out2,fac_b])
|
93 |
-
b4=out2.change(im_fn,[put,fac_b,h],[out3,fac_b])
|
94 |
-
b5=out3.change(im_fn,[put,fac_b,h],[out4,fac_b])
|
95 |
t_switch.change(clear,t_switch,t_switch, cancels=[sta,b1,b2,b3,b4,b5])
|
96 |
|
97 |
b.queue(concurrency_count=100).launch(show_api=False)
|
|
|
52 |
print("Passing")
|
53 |
pass
|
54 |
return t
|
55 |
+
def im_fn(put,fac="",fac_c=None,h=None):
|
56 |
if h == o:
|
57 |
+
if int(fac_c)==1:
|
58 |
+
rn = random.randint(0, 19)
|
59 |
+
model=models[rn]
|
60 |
+
put = f"{put}{fac}"
|
61 |
+
fac = f"{fac} "
|
62 |
+
print (rn)
|
63 |
+
return model(put),fac
|
64 |
+
elif int(fac_c)!=1:
|
65 |
+
pass
|
66 |
elif h != o:
|
67 |
return(None,"")
|
68 |
def cl_fac():
|
69 |
return "",0,None,None,None,None
|
70 |
+
|
71 |
with gr.Blocks() as b:
|
72 |
with gr.Row():
|
73 |
put = gr.Textbox()
|
|
|
87 |
fac_d = gr.Textbox(value=1)
|
88 |
|
89 |
|
90 |
+
b0=btn1.click(cl_fac,None,[fac_b,fac_c,out1,out2,out3,out4],show_progress=False)
|
91 |
b1=btn1.click(start,None,[t_state,t_switch])
|
92 |
sta = t_state.change(end,t_state,t_switch,every=1)
|
93 |
+
b2=btn1.click(im_fn,[put,fac_b,fac_d,h],[out1,fac_b,fac_c])
|
94 |
+
b3=out1.change(im_fn,[put,fac_b,fac_c,h],[out2,fac_b,fac_c])
|
95 |
+
b4=out2.change(im_fn,[put,fac_b,fac_c,h],[out3,fac_b,fac_c])
|
96 |
+
b5=out3.change(im_fn,[put,fac_b,h,fac_c],[out4,fac_b,fac_c])
|
97 |
t_switch.change(clear,t_switch,t_switch, cancels=[sta,b1,b2,b3,b4,b5])
|
98 |
|
99 |
b.queue(concurrency_count=100).launch(show_api=False)
|