import gradio as gr
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="
NILI Compliance Desktop
")
with gr.Column(scale=2):
gr.Markdown("")
with gr.Tabs() as tabs:
with gr.Tab(label="Contract Upload", id=0) as upload_tab:
with gr.Row():
with gr.Column(variant='panel',scale=1):
contract_file_cmpt = gr.File(label="Select Contract File",file_count="single",file_types=[".pdf"],height=150)
with gr.Column(variant='panel',scale=4):
with gr.Row():
with gr.Column(variant='panel'):
contract_text_tbox = gr.Textbox(label="Contract Text",interactive=True,info="Upload .pdf or paste in text. Shift-Enter to add a line")
with gr.Row():
with gr.Column(scale=1):
upload_btn = gr.components.Button(value="Upload Contract", size='sm', variant="primary")
with gr.Column(scale=2):
gr.Markdown("")
with gr.Column(scale=1):
redline_btn = gr.components.Button(value="Redline Contract", size='sm', variant="primary")
with gr.Column(scale=2):
gr.Markdown("")
with gr.Tab(label="Contract Redline", id=1) as redline_tab:
with gr.Row(variant='panel'):
with gr.Column():
sponsor_tbox = gr.Textbox(label="Sponsor:", interactive=True)
compensation_num = gr.Number(label="Contract Value",value=0)
status_ddss = gr.Dropdown(["Pending","Approved","Rejected"],multiselect=False,label="Status", value="Pending")
with gr.Column():
name_tbox = gr.Textbox(label="Name:", interactive=True)
email_tbox = gr.Textbox(label="Email:", interactive=True, type='email',placeholder='xxxxxxx@xxxxxx.xxx')
with gr.Column():
start_date_tbox = gr.Textbox(label="Start Date:", interactive=True, placeholder='MM/DD/YYYY')
end_date_tbox = gr.Textbox(label="End Date:", interactive=True, placeholder='MM/DD/YYYY')
with gr.Row():
with gr.Column(variant='panel'):
gr.components.Markdown(response_label)
contract_redline_html = gr.HTML(label="Contract Redline")
compliance_comments_tbox = gr.Textbox(interactive=True,label='Compliance Comments')
with gr.Row():
with gr.Column():
save_btn = gr.Button(value="Save Contract", size='sm', variant="primary")
with gr.Column():
gr.Markdown("")
with gr.Column():
gr.Markdown("")
with gr.Column():
gr.Markdown("")
with gr.Column():
gr.Markdown("")
with gr.Row(visible=False) as download_row:
with gr.Column(variant='panel'):
file_name_tbox = gr.Textbox(interactive=False,label='File Name',visible=False)
pdf_download_file = gr.File()
download_btn = gr.Button(value="Create Redline PDF", size='sm', variant="primary")
upload_btn.click(pdf_to_text,inputs=[contract_file_cmpt,contract_text_tbox,file_name_tbox],outputs=[contract_text_tbox,file_name_tbox,contract_redline_html,compliance_comments_tbox,pdf_download_file])
download_btn.click(download_pdf,inputs=[compliance_comments_tbox,contract_redline_html,file_name_tbox],outputs=pdf_download_file)
with gr.Column():
gr.Markdown("")
with gr.Column():
gr.Markdown("")
with gr.Column():
gr.Markdown("")
with gr.Column():
gr.Markdown("")
with gr.Tab(label="History", id=3) as history_tab:
with gr.Row():
with gr.Column(variant='panel'):
compliance_history_df = gr.Dataframe(get_compliance_history,
headers=["Sponsor", "Contract Value", "Student Name", "Student Email", "Start Date", "End Date", "Status","Created"],
datatype=["str", "number", "str", "str", "date", "date", "str","date"],
label="Contract History",
interactive=False
)
with gr.Tab(label="Settings", id=4) as settings_tab:
with gr.Row():
with gr.Column(variant='panel',scale=1):
policy_name_dd = gr.Dropdown(schools, multiselect=False,label="NIL Policy Selection", value="Wake Forest University")
policy_name_dd.change(policy_name_change,inputs=policy_name_dd,outputs=None)
redline_btn.click(change_tab, inputs=contract_text_tbox, outputs=tabs).success(chatbot,inputs=[policy_name_dd,contract_text_tbox],
outputs=[contract_redline_html,download_row]).then(update_tboxes,inputs=None,
outputs=[sponsor_tbox,name_tbox,email_tbox,start_date_tbox,end_date_tbox])
save_btn.click(append_to_at_compliance_history,inputs=[policy_name_dd,contract_redline_html,compliance_comments_tbox,sponsor_tbox,compensation_num,status_ddss,name_tbox,email_tbox,start_date_tbox,end_date_tbox],outputs=compliance_history_df)
with gr.Column():
gr.Markdown("")
with gr.Column():
gr.Markdown("")
with gr.Column():
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="NILI Login
")
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('© 2023 Collegiate Influencer Marketing Systems, Inc.
CIMS.AI, CIMS.AI logo, NILI, NILI logo, and EzNIL are trademarks of Collegiate Influencer Marketing Systems, Inc.')