import gradio as gr import requests import os user = "user1" password = "pass1" session = requests.Session() session.auth = (user, password) hostname = "huggingface.co/spaces/xp3857/text-to-image" auth = session.post('http://' + hostname) response = session.get('http://' + hostname + '/rest/applications') print auth print response name = "runwayml/stable-diffusion-v1-5" model = gr.Interface.load(f"models/{name}") o = os.getenv("P") h = "Q" def ac(h=h): print(h) print(o) if h == o: def im_fn(put): return model(put) with gr.Blocks() as b: put = gr.Textbox() out = gr.Image() btn = gr.Button() btn.click(im_fn,put,out) b.queue(concurrency_count=100).launch() elif h != o: print("no") pass ac()