xp3857 commited on
Commit
a8fdbd7
1 Parent(s): 8646ee7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -7,8 +7,7 @@ model = gr.Interface.load(f"models/{name2}")
7
  o = os.getenv("P")
8
 
9
  def ac():
10
- h=gr.Textbox()
11
- def im_fn(put,fac=""):
12
  if h == o:
13
  put = f"{put}{fac}"
14
  fac = f"{fac} "
@@ -18,7 +17,15 @@ def ac():
18
  return(None,None)
19
  def cl_fac():
20
  return ""
 
 
 
 
 
21
  with gr.Blocks() as b:
 
 
 
22
  with gr.Row():
23
  put = gr.Textbox()
24
  btn1 = gr.Button()
@@ -28,9 +35,11 @@ def ac():
28
  with gr.Row():
29
  out3 = gr.Image()
30
  out4 = gr.Image()
 
 
31
  fac_b = gr.Textbox(value="",visible=False)
32
  btn1.click(cl_fac,None,fac_b)
33
- btn1.click(im_fn,[put,fac_b],[out1,fac_b])
34
  out1.change(im_fn,[put,fac_b],[out2,fac_b])
35
  out2.change(im_fn,[put,fac_b],[out3,fac_b])
36
  out3.change(im_fn,[put,fac_b],[out4,fac_b])
 
7
  o = os.getenv("P")
8
 
9
  def ac():
10
+ def im_fn(put,fac="",h=None):
 
11
  if h == o:
12
  put = f"{put}{fac}"
13
  fac = f"{fac} "
 
17
  return(None,None)
18
  def cl_fac():
19
  return ""
20
+ def check_p(h):
21
+ if h==o:
22
+ return gr.update(visible=False)
23
+ elif h!=o:
24
+ return None
25
  with gr.Blocks() as b:
26
+ with gr.Row() as r_p:
27
+ h=gr.Textbox()
28
+ pb=gr.Button()
29
  with gr.Row():
30
  put = gr.Textbox()
31
  btn1 = gr.Button()
 
35
  with gr.Row():
36
  out3 = gr.Image()
37
  out4 = gr.Image()
38
+
39
+ pb.click(check_p,h,r_p)
40
  fac_b = gr.Textbox(value="",visible=False)
41
  btn1.click(cl_fac,None,fac_b)
42
+ btn1.click(im_fn,[h,put,fac_b],[out1,fac_b])
43
  out1.change(im_fn,[put,fac_b],[out2,fac_b])
44
  out2.change(im_fn,[put,fac_b],[out3,fac_b])
45
  out3.change(im_fn,[put,fac_b],[out4,fac_b])