File size: 2,584 Bytes
db3d76d
 
 
 
 
5d19cc4
 
db3d76d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
import re

def extract_entities(text):
    # Using regex to find Pakistani phone numbers
    phone_numbers = re.findall(r'\+\d{2,3}\d{9,12}\b', text)


    # Using regex to find emails
    emails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', text)

    return phone_numbers, emails

def display_extracted_info(phone_numbers, emails):
    if phone_numbers:
        st.subheader("πŸ“ž Extracted Pakistani Phone Numbers:")
        for phone in phone_numbers:
            st.write(f"- {phone}")
    else:
        st.info("No Pakistani phone numbers found.")

    if emails:
        st.subheader("βœ‰οΈ Extracted Emails:")
        for email in emails:
            st.write(f"- {email}")
    else:
        st.info("No emails found.")

def main():
    st.title("πŸ” Pakistan Resume Information Extractor")
    apply_custom_styles()

    st.write("Enter resume text below to extract Pakistani phone numbers and emails.")

    input_text = st.text_area("Paste your resume text here:", height=200)

    if st.button("Extract"):
        if input_text:
            st.markdown("---")
            st.header("πŸ“„ Extracted Information")

            phone_numbers, emails = extract_entities(input_text)
            display_extracted_info(phone_numbers, emails)
        else:
            st.warning("Please enter some text to extract entities.")

        # Add a "Clear" button to reset the input text area
        if st.button("Clear"):
            st.text_area("Paste your resume text here:", value="", height=200)

def apply_custom_styles():
    st.markdown(
        """
        <style>
        body {
            background-color: #f5f5f5; /* Light gray background */
            color: #333333; /* Dark gray text */
        }
        .stTextInput textarea {
            background-color: #ffffff; /* White text area */
            color: #333333; /* Dark gray text in text area */
            border: 2px solid #d9d9d9; /* Light gray border */
        }
        .stButton button {
            background-color: #F16623; /* Orange button */
            color: #ffffff; /* White text on the button */
        }
        .stButton button:hover {
            background-color: #e55c1e; /* Darker orange on hover */
        }
        .st-info {
            background-color: #e6f7ff; /* Light blue info box */
            color: #004085; /* Dark blue text in info box */
            border: 1px solid #b8daff; /* Light blue border */
        }
        </style>
        """,
        unsafe_allow_html=True,
    )

if __name__ == "__main__":
    main()