aminaj commited on
Commit
6f996c0
·
verified ·
1 Parent(s): 29fdb23

Update frontend/main_app.py

Browse files
Files changed (1) hide show
  1. frontend/main_app.py +32 -16
frontend/main_app.py CHANGED
@@ -5,15 +5,24 @@ from backend.analysis import analyze_resume
5
  import os
6
  import shutil
7
 
8
- # Main application including "Upload Resume" and "Resume Analysis" sections - displayed at the left
9
  def render_main_app():
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- col1, col2 = st.columns([1, 2]) # Creating two columns for layout
12
-
13
- with col2:
14
- st.header("Resume Analysis") # Header for the analysis section
15
-
16
- with col1:
17
  st.header("Upload Resume") # Header for the upload section
18
 
19
  # File uploader for PDF resumes
@@ -30,7 +39,7 @@ def render_main_app():
30
  # Save the uploaded file to the temporary directory
31
  with open(os.path.join(temp_dir, resume_file.name), "wb") as f:
32
  f.write(resume_file.getbuffer())
33
-
34
  # Load and split the PDF file into documents and chunks
35
  resume_file_path = os.path.join("temp", resume_file.name)
36
  resume_docs, resume_chunks = load_split_pdf(resume_file_path)
@@ -38,7 +47,7 @@ def render_main_app():
38
  # Create a vector store from the resume chunks
39
  vector_store = create_vector_store(resume_chunks)
40
  st.session_state.vector_store = vector_store # Store vector store in session state
41
-
42
  # Remove the temporary directory and its contents
43
  shutil.rmtree(temp_dir)
44
 
@@ -46,14 +55,21 @@ def render_main_app():
46
  if st.button("Analyze Resume", help="Click to analyze the resume"):
47
  # Combine all document contents into one text string for analysis
48
  full_resume = " ".join([doc.page_content for doc in resume_docs])
49
- # Anlayze the resume
50
  analysis = analyze_resume(full_resume, job_description)
51
  # Store analysis in session state
52
  st.session_state.analysis = analysis
53
-
54
- # Display the analysis result if it exists in session state
55
- if "analysis" in st.session_state:
56
- with col2:
57
- st.write(st.session_state.analysis)
58
  else:
59
- st.info("Please upload a resume and enter a job description to begin.")
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  import os
6
  import shutil
7
 
8
+ # Main application including "Upload Resume" and "Resume Analysis" sections
9
  def render_main_app():
10
+
11
+ # Apply custom CSS to adjust the sidebar width
12
+ st.markdown(
13
+ """
14
+ <style>
15
+ [data-testid="stSidebar"] {
16
+ min-width: 25%;
17
+ max-width: 25%;
18
+ }
19
+ </style>
20
+ """,
21
+ unsafe_allow_html=True
22
+ )
23
 
24
+ # Moving the upload section to the sidebar
25
+ with st.sidebar:
 
 
 
 
26
  st.header("Upload Resume") # Header for the upload section
27
 
28
  # File uploader for PDF resumes
 
39
  # Save the uploaded file to the temporary directory
40
  with open(os.path.join(temp_dir, resume_file.name), "wb") as f:
41
  f.write(resume_file.getbuffer())
42
+
43
  # Load and split the PDF file into documents and chunks
44
  resume_file_path = os.path.join("temp", resume_file.name)
45
  resume_docs, resume_chunks = load_split_pdf(resume_file_path)
 
47
  # Create a vector store from the resume chunks
48
  vector_store = create_vector_store(resume_chunks)
49
  st.session_state.vector_store = vector_store # Store vector store in session state
50
+
51
  # Remove the temporary directory and its contents
52
  shutil.rmtree(temp_dir)
53
 
 
55
  if st.button("Analyze Resume", help="Click to analyze the resume"):
56
  # Combine all document contents into one text string for analysis
57
  full_resume = " ".join([doc.page_content for doc in resume_docs])
58
+ # Analyze the resume
59
  analysis = analyze_resume(full_resume, job_description)
60
  # Store analysis in session state
61
  st.session_state.analysis = analysis
 
 
 
 
 
62
  else:
63
+ st.info("Please upload a resume and enter a job description to begin.")
64
+
65
+ # Display the analysis result if it exists in session state
66
+ if "analysis" in st.session_state:
67
+ st.header("Resume-Job Compatibility Analysis")
68
+ st.write(st.session_state.analysis)
69
+ else:
70
+ st.header("Welcome to the Ultimate Resume Analysis Tool!")
71
+ st.subheader("Your one-stop solution for resume screening and analysis.")
72
+ st.info("Do you want to find out the compatibility between a resume and a job description? So what are you waiting for?")
73
+
74
+ todo = ["Upload a Resume", "Enter a Job Description", "Click on Analyze Resume"]
75
+ st.markdown("\n".join([f"##### {i+1}. {item}" for i, item in enumerate(todo)]))