Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from cv_analyzer import analyze_cv
|
3 |
+
|
4 |
+
st.set_page_config(page_title="CV Analyzer", layout="wide")
|
5 |
+
|
6 |
+
st.title('CV Analyzer')
|
7 |
+
|
8 |
+
uploaded_file = st.file_uploader("Choose a CV file", type=['pdf', 'docx', 'txt'])
|
9 |
+
|
10 |
+
if uploaded_file is not None:
|
11 |
+
file_content = uploaded_file.read()
|
12 |
+
with st.spinner('Analyzing CV...'):
|
13 |
+
result = analyze_cv(file_content)
|
14 |
+
|
15 |
+
if "error" in result:
|
16 |
+
st.error(result["error"])
|
17 |
+
else:
|
18 |
+
# Personal Information
|
19 |
+
st.header("Personal Information")
|
20 |
+
personal_info = result["personal_info"]
|
21 |
+
st.json(personal_info)
|
22 |
+
st.write(f"Personal Information Score: {personal_info['personal_info_score']}")
|
23 |
+
|
24 |
+
# Detected Sections
|
25 |
+
st.header("Detected Sections")
|
26 |
+
st.write(result["detected_sections"])
|
27 |
+
st.write(f"Section Detection Score: {result['section_detection_score']}")
|
28 |
+
|
29 |
+
# Spelling and Grammar
|
30 |
+
st.header("Spelling and Grammar")
|
31 |
+
error_percentage = 100 - result['spelling_grammar_score']
|
32 |
+
st.write(f"Error Percentage: {error_percentage:.2f}%")
|
33 |
+
st.write(f"Spelling and Grammar Score: {result['spelling_grammar_score']:.2f} / 100")
|
34 |
+
|
35 |
+
# Content Quality Analysis
|
36 |
+
st.header("Content Quality Analysis")
|
37 |
+
for section, evaluation in result['content_analysis'].items():
|
38 |
+
st.subheader(section.capitalize())
|
39 |
+
st.json(evaluation)
|
40 |
+
st.write(f"Overall Content Quality Score: {result['overall_score']:.2f} / 10")
|
41 |
+
|
42 |
+
# Total Score
|
43 |
+
st.header("Total CV Score")
|
44 |
+
total_score = (
|
45 |
+
personal_info['personal_info_score'] +
|
46 |
+
result['section_detection_score'] +
|
47 |
+
result['spelling_grammar_score'] +
|
48 |
+
result['overall_score']
|
49 |
+
)
|
50 |
+
st.write(f"Total Score: {total_score:.2f}")
|
51 |
+
|
52 |
+
if __name__ == "__main__":
|
53 |
+
st.sidebar.title("About")
|
54 |
+
st.sidebar.info(
|
55 |
+
"This CV Analyzer extracts personal information, detects sections, "
|
56 |
+
"checks spelling and grammar, analyzes content quality, "
|
57 |
+
"and provides a detailed evaluation of the CV."
|
58 |
+
)
|