Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import re | |
| def extract_entities(text): | |
| # Using regex to find Pakistani phone numbers | |
| phone_numbers = re.findall(r'\b\d{3}-\d{7}\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 main(): | |
| st.title("π Resume Information Extractor") | |
| st.markdown( | |
| """ | |
| <style> | |
| body { | |
| background-color: #F16623; /* Orange background */ | |
| color: #000000; /* Black text */ | |
| } | |
| .stTextInput textarea { | |
| background-color: #FFFFFF; /* White text area */ | |
| color: #000000; /* Black text in text area */ | |
| } | |
| </style> | |
| """, | |
| unsafe_allow_html=True, | |
| ) | |
| 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) | |
| if phone_numbers: | |
| st.subheader("π Extracted Pakistani Phone Numbers:") | |
| for phone in phone_numbers: | |
| st.write(f"- {phone}") | |
| else: | |
| st.write("No Pakistani phone numbers found.") | |
| if emails: | |
| st.subheader("βοΈ Extracted Emails:") | |
| for email in emails: | |
| st.write(f"- {email}") | |
| else: | |
| st.write("No emails found.") | |
| else: | |
| st.warning("Please enter some text to extract entities.") | |
| if __name__ == "__main__": | |
| main() | |