File size: 4,200 Bytes
249590b
 
 
 
 
 
 
 
 
 
1e3ea14
2035c7d
 
 
 
 
 
1e3ea14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2035c7d
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
import os
import subprocess

# Ensure dependencies are installed
required_packages = ["faker", "streamlit", "python-docx"]
for package in required_packages:
    try:
        __import__(package)
    except ImportError:
        subprocess.run(["pip", "install", package])

# Now import modules after installation
from faker import Faker
import streamlit as st
from docx import Document

# Initialize Faker
fake = Faker()

document_types = [
    "TL (Trade License)", "MOA (Memorandum of Association)", "Certificate of Incumbency",
    "Registration Certificate", "Certificate of Formation", "Certificate of Incorporation",
    "Certificate of Incorporation/TL (DED)", "VAT Registration", "Indemnity",
    "Address Proof - Shared Desk", "TL (LLC & DIFC)", "Utility Bill", "Ejari",
    "Shareholding Doc", "POA (Power of Attorney)", "Good Standing Certificate",
    "Incorporation Certificate", "Name Change Certificate", "MOA/TL/Extract/Incumbency",
    "Passport", "EID (Emirates ID)", "Visa", "TL/MOA & Certificate of Incumbency/Registration Certificate",
    "MOA/BR/POA", "BR/POA", "Mandate/BR"
]

def generate_document(doc_type):
    doc = Document()
    doc.add_heading(f'{doc_type}', level=1)
    doc.add_paragraph(f'Generated on: {fake.date_time_this_year()}')
    
    if "Trade License" in doc_type:
        doc.add_paragraph(f'Company Name: {fake.company()}')
        doc.add_paragraph(f'Registration Number: {fake.uuid4()}')
        doc.add_paragraph(f'Issued Date: {fake.date()}')
        doc.add_paragraph(f'Expiry Date: {fake.date()}')
    elif "MOA" in doc_type:
        doc.add_paragraph(f'Company: {fake.company()}')
        doc.add_paragraph(f'Founders: {fake.name()}, {fake.name()}')
        doc.add_paragraph(f'Capital: {fake.random_int(10000, 500000)} AED')
        doc.add_paragraph(f'Date of Establishment: {fake.date()}')
    elif "Certificate" in doc_type:
        doc.add_paragraph(f'Business Name: {fake.company()}')
        doc.add_paragraph(f'Incorporation Date: {fake.date()}')
        doc.add_paragraph(f'Registration ID: {fake.uuid4()}')
    elif "VAT Registration" in doc_type:
        doc.add_paragraph(f'Company Name: {fake.company()}')
        doc.add_paragraph(f'VAT Number: {fake.random_int(100000, 999999)}')
        doc.add_paragraph(f'Registration Date: {fake.date()}')
    elif "Indemnity" in doc_type:
        doc.add_paragraph(f'Indemnified Party: {fake.name()}')
        doc.add_paragraph(f'Indemnifier: {fake.name()}')
        doc.add_paragraph(f'Agreement Date: {fake.date()}')
    elif "Address Proof" in doc_type or "Utility Bill" in doc_type or "Ejari" in doc_type:
        doc.add_paragraph(f'Name: {fake.name()}')
        doc.add_paragraph(f'Address: {fake.address()}')
        doc.add_paragraph(f'Document Date: {fake.date()}')
    elif "Shareholding Doc" in doc_type:
        doc.add_paragraph(f'Shareholder: {fake.name()}')
        doc.add_paragraph(f'Company: {fake.company()}')
        doc.add_paragraph(f'Share Percentage: {fake.random_int(1, 100)}%')
    elif "POA" in doc_type:
        doc.add_paragraph(f'Grantor: {fake.name()}')
        doc.add_paragraph(f'Grantee: {fake.name()}')
        doc.add_paragraph(f'Authority Granted: Full Business Authority')
    elif "Passport" in doc_type or "EID" in doc_type or "Visa" in doc_type:
        doc.add_paragraph(f'Name: {fake.name()}')
        doc.add_paragraph(f'Document Number: {fake.uuid4()}')
        doc.add_paragraph(f'Issue Date: {fake.date()}')
        doc.add_paragraph(f'Expiry Date: {fake.date()}')
    else:
        doc.add_paragraph(f'Generated Placeholder for {doc_type}')
    
    file_name = f"{doc_type.replace(' ', '_')}.docx"
    doc.save(file_name)
    return file_name

# Streamlit UI
st.title("📄 Document Generator")
st.write("Generate Business and Legal Documents with Synthetic Data")

doc_choice = st.selectbox("Select Document Type:", document_types)

if st.button("Generate Document"):
    file_path = generate_document(doc_choice)
    with open(file_path, "rb") as file:
        st.download_button(label="Download Document", data=file, file_name=file_path, mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document")
    os.remove(file_path)