xp3857 commited on
Commit
ae7a8b1
1 Parent(s): 09b07b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -15
app.py CHANGED
@@ -54,18 +54,21 @@ def ac():
54
  print("Passing")
55
  pass
56
  return t
57
- def im_fn(put,fac="",h=None):
58
  if h == o:
59
- rn = random.randint(0, 19)
60
- model=models[rn]
61
- put = f"{put}{fac}"
62
- fac = f"{fac} "
63
- print (rn)
64
- return model(put),fac
 
 
 
65
  elif h != o:
66
- return(None,None)
67
  def cl_fac():
68
- return "",None,None,None,None
69
  with gr.Blocks() as b:
70
  with gr.Row():
71
  put = gr.Textbox()
@@ -81,15 +84,17 @@ def ac():
81
  t_state=gr.Number()
82
  t_switch=gr.Textbox(value=0)
83
  fac_b = gr.Textbox(value="",visible=False)
84
-
85
- b0=btn1.click(cl_fac,None,[fac_b,out1,out2,out3,out4],show_progress=False)
86
 
 
 
87
  b1=btn1.click(start,None,[t_state,t_switch])
88
  sta = t_state.change(end,t_state,t_switch,every=1)
89
- b2=btn1.click(im_fn,[put,fac_b,h],[out1,fac_b])
90
- b3=out1.change(im_fn,[put,fac_b,h],[out2,fac_b])
91
- b4=out2.change(im_fn,[put,fac_b,h],[out3,fac_b])
92
- b5=out3.change(im_fn,[put,fac_b,h],[out4,fac_b])
93
  t_switch.change(clear,t_switch,t_switch, cancels=[sta,b1,b2,b3,b4,b5])
94
 
95
  b.queue(concurrency_count=100).launch(show_api=False)
 
54
  print("Passing")
55
  pass
56
  return t
57
+ def im_fn(put,fac="",val,h=None):
58
  if h == o:
59
+ if int(val) != 0:
60
+ rn = random.randint(0, 19)
61
+ model=models[rn]
62
+ put = f"{put}{fac}"
63
+ fac = f"{fac} "
64
+ print (rn)
65
+ return model(put),fac,1
66
+ elif int(val)==0:
67
+ return None,"",0
68
  elif h != o:
69
+ return(None,"")
70
  def cl_fac():
71
+ return "",0,None,None,None,None
72
  with gr.Blocks() as b:
73
  with gr.Row():
74
  put = gr.Textbox()
 
84
  t_state=gr.Number()
85
  t_switch=gr.Textbox(value=0)
86
  fac_b = gr.Textbox(value="",visible=False)
87
+ fac_c = gr.Textbox(value=0)
88
+ fac_d = gr.Textbox(value=1)
89
 
90
+
91
+ b0=btn1.click(cl_fac,None,[fac_b,fac_c,out1,out2,out3,out4],show_progress=False)
92
  b1=btn1.click(start,None,[t_state,t_switch])
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
  t_switch.change(clear,t_switch,t_switch, cancels=[sta,b1,b2,b3,b4,b5])
99
 
100
  b.queue(concurrency_count=100).launch(show_api=False)