Spaces:
Sleeping
Sleeping
Commit
Β·
db3d76d
1
Parent(s):
1846199
requirements.txt
Browse filestransformers
streamlit
tensorFlow
app.py
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import re
|
3 |
+
|
4 |
+
def extract_entities(text):
|
5 |
+
# Using regex to find Pakistani phone numbers
|
6 |
+
phone_numbers = re.findall(r'\b\d{3}-\d{7}\b', text)
|
7 |
+
|
8 |
+
# Using regex to find emails
|
9 |
+
emails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', text)
|
10 |
+
|
11 |
+
return phone_numbers, emails
|
12 |
+
|
13 |
+
def display_extracted_info(phone_numbers, emails):
|
14 |
+
if phone_numbers:
|
15 |
+
st.subheader("π Extracted Pakistani Phone Numbers:")
|
16 |
+
for phone in phone_numbers:
|
17 |
+
st.write(f"- {phone}")
|
18 |
+
else:
|
19 |
+
st.info("No Pakistani phone numbers found.")
|
20 |
+
|
21 |
+
if emails:
|
22 |
+
st.subheader("βοΈ Extracted Emails:")
|
23 |
+
for email in emails:
|
24 |
+
st.write(f"- {email}")
|
25 |
+
else:
|
26 |
+
st.info("No emails found.")
|
27 |
+
|
28 |
+
def main():
|
29 |
+
st.title("π Pakistan Resume Information Extractor")
|
30 |
+
apply_custom_styles()
|
31 |
+
|
32 |
+
st.write("Enter resume text below to extract Pakistani phone numbers and emails.")
|
33 |
+
|
34 |
+
input_text = st.text_area("Paste your resume text here:", height=200)
|
35 |
+
|
36 |
+
if st.button("Extract"):
|
37 |
+
if input_text:
|
38 |
+
st.markdown("---")
|
39 |
+
st.header("π Extracted Information")
|
40 |
+
|
41 |
+
phone_numbers, emails = extract_entities(input_text)
|
42 |
+
display_extracted_info(phone_numbers, emails)
|
43 |
+
else:
|
44 |
+
st.warning("Please enter some text to extract entities.")
|
45 |
+
|
46 |
+
# Add a "Clear" button to reset the input text area
|
47 |
+
if st.button("Clear"):
|
48 |
+
st.text_area("Paste your resume text here:", value="", height=200)
|
49 |
+
|
50 |
+
def apply_custom_styles():
|
51 |
+
st.markdown(
|
52 |
+
"""
|
53 |
+
<style>
|
54 |
+
body {
|
55 |
+
background-color: #f5f5f5; /* Light gray background */
|
56 |
+
color: #333333; /* Dark gray text */
|
57 |
+
}
|
58 |
+
.stTextInput textarea {
|
59 |
+
background-color: #ffffff; /* White text area */
|
60 |
+
color: #333333; /* Dark gray text in text area */
|
61 |
+
border: 2px solid #d9d9d9; /* Light gray border */
|
62 |
+
}
|
63 |
+
.stButton button {
|
64 |
+
background-color: #F16623; /* Orange button */
|
65 |
+
color: #ffffff; /* White text on the button */
|
66 |
+
}
|
67 |
+
.stButton button:hover {
|
68 |
+
background-color: #e55c1e; /* Darker orange on hover */
|
69 |
+
}
|
70 |
+
.st-info {
|
71 |
+
background-color: #e6f7ff; /* Light blue info box */
|
72 |
+
color: #004085; /* Dark blue text in info box */
|
73 |
+
border: 1px solid #b8daff; /* Light blue border */
|
74 |
+
}
|
75 |
+
</style>
|
76 |
+
""",
|
77 |
+
unsafe_allow_html=True,
|
78 |
+
)
|
79 |
+
|
80 |
+
if __name__ == "__main__":
|
81 |
+
main()
|