syedabdullah32 commited on
Commit
331dbe9
Β·
1 Parent(s): a71991c

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -96
app.py DELETED
@@ -1,96 +0,0 @@
1
- import streamlit as st
2
- import re
3
- import spacy
4
-
5
- # Load the spaCy English model
6
- nlp = spacy.load("en_core_web_sm")
7
-
8
- def extract_entities(text):
9
- # Using spaCy for Named Entity Recognition (NER) to extract names
10
- doc = nlp(text)
11
- names = [ent.text for ent in doc.ents if ent.label_ == "PERSON"]
12
-
13
- # Using regex to find Pakistani phone numbers
14
- phone_numbers = re.findall(r'\+\d{2,3}\d{9,12}\b', text)
15
-
16
- # Using regex to find emails
17
- emails = re.findall(r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b', text)
18
-
19
- return names, phone_numbers, emails
20
-
21
- def display_extracted_info(names, phone_numbers, emails):
22
- if names:
23
- st.subheader("πŸ‘€ Extracted Names:")
24
- for name in names:
25
- st.write(f"- {name}")
26
- else:
27
- st.info("No names found.")
28
-
29
- if phone_numbers:
30
- st.subheader("πŸ“ž Extracted Pakistani Phone Numbers:")
31
- for phone in phone_numbers:
32
- st.write(f"- {phone}")
33
- else:
34
- st.info("No Pakistani phone numbers found.")
35
-
36
- if emails:
37
- st.subheader("βœ‰οΈ Extracted Emails:")
38
- for email in emails:
39
- st.write(f"- {email}")
40
- else:
41
- st.info("No emails found.")
42
-
43
- def main():
44
- st.title("πŸ” Resume Information Extractor")
45
- apply_custom_styles()
46
-
47
- st.write("Enter resume text below to extract information.")
48
-
49
- input_text = st.text_area("Paste your resume text here:", height=200)
50
-
51
- if st.button("Extract"):
52
- if input_text:
53
- st.markdown("---")
54
- st.header("πŸ“„ Extracted Information")
55
-
56
- names, phone_numbers, emails = extract_entities(input_text)
57
- display_extracted_info(names, phone_numbers, emails)
58
- else:
59
- st.warning("Please enter some text to extract entities.")
60
-
61
- # Add a "Clear" button to reset the input text area
62
- if st.button("Clear"):
63
- st.text_area("Paste your resume text here:", value="", height=200)
64
-
65
- def apply_custom_styles():
66
- st.markdown(
67
- """
68
- <style>
69
- body {
70
- background-color: #f5f5f5; /* Light gray background */
71
- color: #333333; /* Dark gray text */
72
- }
73
- .stTextInput textarea {
74
- background-color: #ffffff; /* White text area */
75
- color: #333333; /* Dark gray text in text area */
76
- border: 2px solid #d9d9d9; /* Light gray border */
77
- }
78
- .stButton button {
79
- background-color: #F16623; /* Orange button */
80
- color: #ffffff; /* White text on the button */
81
- }
82
- .stButton button:hover {
83
- background-color: #e55c1e; /* Darker orange on hover */
84
- }
85
- .st-info {
86
- background-color: #e6f7ff; /* Light blue info box */
87
- color: #004085; /* Dark blue text in info box */
88
- border: 1px solid #b8daff; /* Light blue border */
89
- }
90
- </style>
91
- """,
92
- unsafe_allow_html=True,
93
- )
94
-
95
- if __name__ == "__main__":
96
- main()