File size: 1,529 Bytes
826aac3
 
0d4024a
826aac3
 
 
 
 
 
 
 
 
0d4024a
826aac3
 
 
 
 
 
 
 
0d4024a
 
826aac3
 
 
0d4024a
 
 
826aac3
0d4024a
 
 
 
826aac3
 
 
 
 
 
 
 
 
 
 
0d4024a
 
826aac3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0d4024a
 
826aac3
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
import gradio as gr


# Fake user database
users_db = {
    "jsmith": {
        "username": "jsmith",
        "email": "[email protected]",
        "name": "John Smith",
        "user_id": "US789456",
        "jobtitle": "Software Engineer",
        "department": "Engineering",
        "country": "United States",
    },
    "mhacker": {
        "username": "mhacker",
        "email": "[email protected]",
        "name": "Maria Hacker",
        "user_id": "US123789",
        "jobtitle": "Security Specialist",
        "department": "Pentests",
        "country": "Germany",
    },
}


def lookup_user(username: str) -> str:
    """Function to lookup user information.

    Company User Lookup System. Enter a username to get user details.

    Returns:
        A formatted string with user details if found, otherwise an
        error message.
    """
    if username in users_db:
        user = users_db[username]
        return f"""User Information:
Username: {user['username']}
Email: {user['email']}
Name: {user['name']}
User ID: {user['user_id']}
Job Title: {user['jobtitle']}
Department: {user['department']}
Country: {user['country']}"""

    return """User Not Found
Username: Not found
Email: N/A
Name: N/A
User ID: N/A
Job Title: N/A
Department: N/A
Country: N/A"""


# Create Gradio Interface
gr_internal_company = gr.Interface(
    fn=lookup_user,
    inputs=["text"],
    outputs=["text"],
    title="Company User Lookup System",
    description="Company User Lookup System.",
    theme="default",
)