import gradio as gr import requests import os name2 = "runwayml/stable-diffusion-v1-5" model = gr.Interface.load(f"models/{name2}") o = os.getenv("P") def ac(): def im_fn(put,fac="",h=None): if h == o: put = f"{put}{fac}" fac = f"{fac} " return model(put),fac elif h != o: print ("Enter Password") return(None,None) def cl_fac(): return "" def check_p(h): if h==o: return gr.update(visible=False) elif h!=o: return None with gr.Blocks() as b: with gr.Row() as r_p: h=gr.Textbox() pb=gr.Button() with gr.Row(): put = gr.Textbox() btn1 = gr.Button() with gr.Row(): out1 = gr.Image() out2 = gr.Image() with gr.Row(): out3 = gr.Image() out4 = gr.Image() pb.click(check_p,h,r_p) fac_b = gr.Textbox(value="",visible=False) btn1.click(cl_fac,None,fac_b) btn1.click(im_fn,[h,put,fac_b],[out1,fac_b]) out1.change(im_fn,[put,fac_b],[out2,fac_b]) out2.change(im_fn,[put,fac_b],[out3,fac_b]) out3.change(im_fn,[put,fac_b],[out4,fac_b]) b.queue(concurrency_count=100).launch(show_api=False) ac()