Compliance_Test / app.py
dwipper's picture
Update app.py
e95ec56
raw
history blame
2.67 kB
import os
import gradio as gr
import requests
def login_auth(username, password):
if username == password:
#gr.Info("Login Success")
return {login_row: gr.Row(visible=False), app_row: gr.Row(visible=True)}
#gr.Info("Login Failed")
print(f"Invalid user/password combination")
return {login_row: gr.Row(visible=True), app_row: gr.Row(visible=False)}
with gr.Blocks() as iface:
with gr.Row(visible=False) as app_row:
with gr.Column():
with gr.Row():
with gr.Column(scale=2):
gr.Image(label="Logo", value="Nili_v2_Character.png", width=100, height=100, show_download_button=False,
interactive=False, show_label=False, elem_id="logo", container=False)
with gr.Column(scale=2):
gr.Markdown(value="<H2 style='text-align: center;'>NILI Compliance Desktop</h2>")
with gr.Column(scale=2):
gr.Markdown("")
with gr.Row(visible=True) as login_row:
with gr.Column():
with gr.Row():
with gr.Column(scale=2):
gr.Markdown("")
with gr.Column(scale=1):
with gr.Row():
gr.Image(label="Logo", value="Nili_v2_Character.png", width=200, height=200,
show_download_button=False,
interactive=False, show_label=False, elem_id="logo", container=False)
with gr.Row():
gr.Markdown(value="<H2 style='text-align: center;'>NILI Login</h2>")
with gr.Column(scale=2):
gr.Markdown("")
with gr.Row():
with gr.Column(scale=2):
gr.Markdown("")
with gr.Column(scale=1, variant='panel'):
username_tbox = gr.Textbox(label="User Name", interactive=True)
password_tbox = gr.Textbox(label="Password", interactive=True, type='password')
submit_btn = gr.Button(value='Submit', variant='primary', size='sm')
submit_btn.click(login_auth, inputs=[username_tbox, password_tbox], outputs=[login_row,app_row])
with gr.Column(scale=2):
gr.Markdown("")
with gr.Row():
with gr.Column(scale=4):
gr.HTML('<center><i>© 2023 Collegiate Influencer Marketing Systems, Inc.</i><br>CIMS.AI, CIMS.AI logo, NILI, NILI logo, and EzNIL are trademarks of Collegiate Influencer Marketing Systems, Inc.</center>')
iface.queue()
iface.launch(show_api=False)