Spaces:
Runtime error
Runtime error
add pw
Browse files28 unmodified lines2930313233343513 unmodified lines49505152535412 unmodified lines6768697071727328 unmodified linesproject="pdr-imagen"aiplatform.init(project=project, credentials=credentials)def generate_image(prompt,model_name):try:model = ImageGenerationModel.from_pretrained(model_name)response = model.generate_images(13 unmodified linesgr.Markdown("# <center>Google Vertex Imagen Generator</center>")#instructionswith gr.Accordion("Instructions & Tips",label="instructions",open=False):with gr.Row():12 unmodified lineswith gr.Accordion("Image Output",label="Image Output",open=True):output_image = gr.Image(label="Image")btn.click(fn=generate_image, inputs=[text, model ], outputs=output_image, api_name=False)text.submit(fn=generate_image, inputs=[text, model ], outputs=output_image, api_name="generate_image") # Generate an api endpoint in Gradio / HFdemo.launch(share=False)28 unmodified lines293031323334353637383913 unmodified lines5354555657585960616212 unmodified lines7576777879808128 unmodified linesproject="pdr-imagen"aiplatform.init(project=project, credentials=credentials)def generate_image(pw,prompt,model_name):if pw != os.getenv("PW"):raise gr.Error("Invalid password. Please try again.")try:model = ImageGenerationModel.from_pretrained(model_name)response = model.generate_images(13 unmodified linesgr.Markdown("# <center>Google Vertex Imagen Generator</center>")#passwordpw = gr.Textbox(label="Password", type="password", placeholder="Enter the password to unlock the service")gr.Markdown("Need access? Send a DM to @HeaversMike on Twitter or send me an email / Slack msg.")#instructionswith gr.Accordion("Instructions & Tips",label="instructions",open=False):with gr.Row():12 unmodified lineswith gr.Accordion("Image Output",label="Image Output",open=True):output_image = gr.Image(label="Image")btn.click(fn=generate_image, inputs=[pw,text, model ], outputs=output_image, api_name=False)text.submit(fn=generate_image, inputs=[pw,text, model ], outputs=output_image, api_name="generate_image") # Generate an api endpoint in Gradio / HFdemo.launch(share=False)
app.py+11-3