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( """ """, unsafe_allow_html=True, ) if __name__ == "__main__": main()