authtest / app.py
satpalsr's picture
Create app.py
158f068
raw
history blame contribute delete
579 Bytes
import gradio as gr
import os
USER = os.environ["USER"]
PASSWORD = os.environ["PASSWORD"]
def get_msg(name):
return "Hello " + name + "!"
def verify_auth(username, password):
if username == USER and password == PASSWORD:
return True
else:
return False
with gr.Blocks() as demo:
input = gr.Textbox(label="Prompt", elem_id="textbox")
output = gr.Textbox(label="Output", elem_id="textbox")
button = gr.Button(value="Make Magic", elem_id="button")
button.click(get_msg, inputs=[input], outputs=[output])
demo.launch(auth=verify_auth)