Spaces:
Running on Zero
Running on Zero
| import spaces | |
| import gradio as gr | |
| from autofill_policies_logic import generate_documents | |
| def generate_documents_gpu(name, email, address): | |
| return generate_documents(name, email, address) | |
| custom_css = """ | |
| .gradio-container { | |
| max-width: 1600px !important; | |
| margin: auto !important; | |
| padding-left: 30px !important; | |
| padding-right: 30px !important; | |
| background: #E7E1D6 !important; | |
| } | |
| .app-title { | |
| text-align: center !important; | |
| font-size: 31px !important; | |
| font-weight: 700 !important; | |
| color: #0F3D3E !important; | |
| margin: 20px 0 24px 0 !important; | |
| } | |
| .app-description { | |
| font-size: 20px !important; | |
| line-height: 1.6 !important; | |
| color: #0F3D3E !important; | |
| } | |
| #custom-generate-button { | |
| background: #0F3D3E !important; | |
| color: white !important; | |
| border: none !important; | |
| padding: 0.6em 1.2em !important; | |
| border-radius: 5px !important; | |
| font-size: 16px !important; | |
| } | |
| #custom-generate-button:hover { | |
| background: #0D292A !important; | |
| font-size: 20px !important; | |
| } | |
| .field label span { | |
| font-size: 20px !important; | |
| font-weight: 600; | |
| color: #0F3D3E; | |
| } | |
| .field label { | |
| margin-bottom: 4px !important; | |
| } | |
| #pdf-outputs label { | |
| font-size: 14px !important; | |
| color: #0F3D3E !important; | |
| } | |
| #zip-output label { | |
| font-size: 14px !important; | |
| color: #0F3D3E !important; | |
| } | |
| """ | |
| with gr.Blocks( | |
| title="Privacy Documents Generator" | |
| ) as demo: | |
| gr.HTML( | |
| """ | |
| <div class="app-title"> | |
| Privacy Documents Generator | |
| </div> | |
| <div class="app-description"> | |
| Fill in the details below to autofill the relevant fields and | |
| generate your company privacy documents: | |
| <br><br> | |
| • Data Processing Agreement | |
| <br> | |
| • Privacy Policy | |
| <br> | |
| • Right to Erasure Request Form | |
| </div> | |
| """ | |
| ) | |
| with gr.Row(): | |
| name_input = gr.Textbox(label="Company name", placeholder="Example Ltd.", elem_classes=["field"]) | |
| email_input = gr.Textbox(label="Email", placeholder="privacy@example.com", elem_classes=["field"]) | |
| address_input = gr.Textbox(label="Address", placeholder="Street, city, country", elem_classes=["field"]) | |
| generate_button = gr.Button("Generate documents", elem_id="custom-generate-button") | |
| pdf_outputs = gr.Files(label="Download generated documents", elem_id="pdf-outputs") | |
| zip_output = gr.File(label="Download documents as ZIP", elem_id="zip-output") | |
| generate_button.click( | |
| fn=generate_documents_gpu, | |
| inputs=[name_input, email_input, address_input], | |
| outputs=[pdf_outputs, zip_output], | |
| ) | |
| if __name__ == "__main__": | |
| demo.queue() | |
| demo.launch(css=custom_css) | |