|
import streamlit as st |
|
import re |
|
|
|
def extract_entities(text): |
|
|
|
names = re.findall(r'\b[A-Z][a-z]+ [A-Z][a-z]+\b', text) |
|
|
|
|
|
phone_numbers = re.findall(r'\+\d{2,3}\d{9,12}\b', text) |
|
|
|
|
|
emails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', text) |
|
|
|
return names, phone_numbers, emails |
|
|
|
def display_extracted_info(names, phone_numbers, emails): |
|
if names: |
|
st.subheader("π€ Extracted Names:") |
|
for name in names: |
|
st.write(f"- {name}") |
|
else: |
|
st.info("No names found.") |
|
|
|
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("π Pakistani Resume Information Extractor") |
|
apply_custom_styles() |
|
|
|
st.write("Enter resume text below to extract Pakistani phone numbers +92 and emails and Name.") |
|
|
|
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") |
|
|
|
names, phone_numbers, emails = extract_entities(input_text) |
|
display_extracted_info(names, phone_numbers, emails) |
|
else: |
|
st.warning("Please enter some text to extract entities.") |
|
|
|
|
|
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() |
|
|