Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
@@ -1,84 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
import os
|
3 |
-
from cv_analyzer import analyze_cv
|
4 |
-
from cv_quality import CV
|
5 |
-
from get_supabase import Supabase
|
6 |
-
from datetime import datetime
|
7 |
-
|
8 |
-
st.set_page_config(page_title="CV Analyzer", layout="wide")
|
9 |
-
st.title('CV Analyzer')
|
10 |
-
|
11 |
-
# Initialize Supabase client
|
12 |
-
supabase_client = Supabase().init_supabase_client()
|
13 |
-
|
14 |
-
# Supabase storage details
|
15 |
-
BUCKET_NAME = "CVs UX"
|
16 |
-
SUPABASE_PROJECT_ID = "abjtqzgnrtsikkqgnqeg"
|
17 |
-
|
18 |
-
uploaded_file = st.file_uploader("Choose a CV file", type=['pdf', 'docx', 'txt'])
|
19 |
-
|
20 |
-
if uploaded_file is not None:
|
21 |
-
with st.spinner('Uploading and analyzing CV...'):
|
22 |
-
# Upload file to Supabase storage
|
23 |
-
file_path = f"{uploaded_file.name}"
|
24 |
-
|
25 |
-
with uploaded_file as f:
|
26 |
-
supabase_client.storage.from_(BUCKET_NAME).upload(
|
27 |
-
file=f,
|
28 |
-
path=file_path,
|
29 |
-
file_options={"cache-control": "3600", "upsert": "true"}
|
30 |
-
)
|
31 |
-
|
32 |
-
# Construct the public URL of the uploaded file
|
33 |
-
timestamp = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
34 |
-
file_url = f"https://{SUPABASE_PROJECT_ID}.supabase.co/storage/v1/object/public/{BUCKET_NAME}/{file_path}?t={timestamp}"
|
35 |
-
|
36 |
-
# Create CV object with the file URL
|
37 |
-
cv = CV(file_url)
|
38 |
-
result = cv.analyse_cv_quality()
|
39 |
-
|
40 |
-
if "error" in result:
|
41 |
-
st.error(result["error"])
|
42 |
-
else:
|
43 |
-
# Display results
|
44 |
-
# Personal Information
|
45 |
-
st.header("Personal Information")
|
46 |
-
personal_info = result["personal_info"]
|
47 |
-
st.json(personal_info)
|
48 |
-
st.write(f"Personal Information Score: {personal_info['personal_info_score']}")
|
49 |
-
|
50 |
-
# Detected Sections
|
51 |
-
st.header("Detected Sections")
|
52 |
-
st.write(result["detected_sections"])
|
53 |
-
st.write(f"Section Detection Score: {result['section_detection_score']}")
|
54 |
-
|
55 |
-
# Spelling and Grammar
|
56 |
-
st.header("Spelling and Grammar")
|
57 |
-
st.write(f"Error Percentage: {result['spelling_grammar_error_percentage']:.2f}%")
|
58 |
-
st.write(f"Spelling and Grammar Score: {result['spelling_grammar_score']}")
|
59 |
-
|
60 |
-
# Content Quality Analysis
|
61 |
-
st.header("Content Quality Analysis")
|
62 |
-
for section, evaluation in result['content_analysis'].items():
|
63 |
-
st.subheader(section.capitalize())
|
64 |
-
st.json(evaluation)
|
65 |
-
|
66 |
-
st.write(f"Overall Content Quality Score: {result['overall_score']:.2f} / 10")
|
67 |
-
|
68 |
-
# Total Score
|
69 |
-
st.header("Total CV Score")
|
70 |
-
total_score = (
|
71 |
-
personal_info['personal_info_score'] +
|
72 |
-
result['section_detection_score'] +
|
73 |
-
result['spelling_grammar_score'] +
|
74 |
-
result['overall_score']
|
75 |
-
)
|
76 |
-
st.write(f"Total Score: {total_score:.2f}")
|
77 |
-
|
78 |
-
if __name__ == "__main__":
|
79 |
-
st.sidebar.title("About")
|
80 |
-
st.sidebar.info(
|
81 |
-
"This CV Analyzer extracts personal information, detects sections, "
|
82 |
-
"checks spelling and grammar, analyzes content quality, "
|
83 |
-
"and provides a detailed evaluation of the CV."
|
84 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|