File size: 2,729 Bytes
648e00c
2e2bea2
 
 
bb7933e
 
 
 
2e2bea2
 
 
 
 
 
 
 
 
7a1a1fc
 
 
 
 
 
 
 
 
 
 
 
 
 
2e2bea2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a651144
2e2bea2
7a1a1fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e2bea2
 
 
 
 
 
 
32ea556
 
2e2bea2
 
bb7933e
2e2bea2
 
 
 
1f31826
bb7933e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import spaces
import gradio as gr
from autofill_policies_logic import generate_documents

@spaces.GPU(duration=60)
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)