Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -54,14 +54,17 @@ def ac():
|
|
54 |
else:
|
55 |
return gr.update(value=0),None
|
56 |
def im_fn(put,fac="",h=None):
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
65 |
def cl_fac():
|
66 |
return "",gr.HTML.update("", visible=False)
|
67 |
with gr.Blocks(css=css) as b:
|
@@ -74,7 +77,6 @@ def ac():
|
|
74 |
btn1 = gr.Button("Run")
|
75 |
btn2 = gr.Button("Clear",style="background:blue;")
|
76 |
message=gr.HTML("", visible=False)
|
77 |
-
progress=gr.Progress()
|
78 |
with gr.Row():
|
79 |
out1 = gr.Image()
|
80 |
out2 = gr.Image()
|
@@ -89,13 +91,13 @@ def ac():
|
|
89 |
def clear_all():
|
90 |
return "",None,None,None,None,None,None,1
|
91 |
fac_b = gr.Textbox(value="",visible=False)
|
92 |
-
btn1.click(cl_fac,None,[fac_b,message]
|
93 |
-
b1=btn1.click(start,None,[t_state,t_switch]
|
94 |
sta = t_state.change(end,t_state,[t_switch,message],every=1,show_progress=False)
|
95 |
-
b2=btn1.click(im_fn,[put,fac_b,h],[out1,fac_b], show_progress=
|
96 |
-
b3=out1.change(im_fn,[put,fac_b,h],[out2,fac_b], show_progress=
|
97 |
-
b4=out2.change(im_fn,[put,fac_b,h],[out3,fac_b], show_progress=
|
98 |
-
b5=out3.change(im_fn,[put,fac_b,h],[out4,fac_b], show_progress=
|
99 |
swi=t_switch.change(clear,None,[t_switch,fac_b], cancels=[sta,b2,b3,b4,b5],show_progress=False)
|
100 |
btn2.click(clear_all, None,[fac_b,put,out1,out2,out3,out4,t_state,t_switch],cancels=[b1,sta,b2,b3,b4,b5],show_progress=False)
|
101 |
b.queue(concurrency_count=100).launch(show_api=False)
|
|
|
54 |
else:
|
55 |
return gr.update(value=0),None
|
56 |
def im_fn(put,fac="",h=None):
|
57 |
+
try:
|
58 |
+
if h == o:
|
59 |
+
put = f"{put}{fac}"
|
60 |
+
fac = f"{fac} "
|
61 |
+
rn = random.randint(0, 19)
|
62 |
+
model=models[rn]
|
63 |
+
return model(put),fac
|
64 |
+
elif h != o:
|
65 |
+
return(None,None)
|
66 |
+
except Exception:
|
67 |
+
pass
|
68 |
def cl_fac():
|
69 |
return "",gr.HTML.update("", visible=False)
|
70 |
with gr.Blocks(css=css) as b:
|
|
|
77 |
btn1 = gr.Button("Run")
|
78 |
btn2 = gr.Button("Clear",style="background:blue;")
|
79 |
message=gr.HTML("", visible=False)
|
|
|
80 |
with gr.Row():
|
81 |
out1 = gr.Image()
|
82 |
out2 = gr.Image()
|
|
|
91 |
def clear_all():
|
92 |
return "",None,None,None,None,None,None,1
|
93 |
fac_b = gr.Textbox(value="",visible=False)
|
94 |
+
btn1.click(cl_fac,None,[fac_b,message])
|
95 |
+
b1=btn1.click(start,None,[t_state,t_switch])
|
96 |
sta = t_state.change(end,t_state,[t_switch,message],every=1,show_progress=False)
|
97 |
+
b2=btn1.click(im_fn,[put,fac_b,h],[out1,fac_b], show_progress=True)
|
98 |
+
b3=out1.change(im_fn,[put,fac_b,h],[out2,fac_b], show_progress=True)
|
99 |
+
b4=out2.change(im_fn,[put,fac_b,h],[out3,fac_b], show_progress=True)
|
100 |
+
b5=out3.change(im_fn,[put,fac_b,h],[out4,fac_b], show_progress=True)
|
101 |
swi=t_switch.change(clear,None,[t_switch,fac_b], cancels=[sta,b2,b3,b4,b5],show_progress=False)
|
102 |
btn2.click(clear_all, None,[fac_b,put,out1,out2,out3,out4,t_state,t_switch],cancels=[b1,sta,b2,b3,b4,b5],show_progress=False)
|
103 |
b.queue(concurrency_count=100).launch(show_api=False)
|