CR7CAD commited on
Commit
5d07781
·
verified ·
1 Parent(s): b1a9b4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -34
app.py CHANGED
@@ -7,22 +7,33 @@ import numpy as np
7
  from scipy.spatial.distance import cosine
8
  import time
9
 
10
- # Set page title
11
- st.set_page_config(page_title="Resume Analyzer and Company Suitability Checker")
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  #####################################
14
  # Preload Models
15
  #####################################
16
  @st.cache_resource(show_spinner=True)
17
- def load_models(summarization_model="google/pegasus-xsum", similarity_model="sentence-transformers/all-MiniLM-L6-v2"):
18
  """Load models at startup"""
19
  with st.spinner("Loading AI models... This may take a minute on first run."):
20
  models = {}
21
  # Load summarization model
22
- models['summarizer'] = pipeline("summarization", model=summarization_model)
23
 
24
  # Load feature extraction model for similarity
25
- models['feature_extractor'] = pipeline("feature-extraction", model=similarity_model)
26
 
27
  return models
28
 
@@ -139,31 +150,6 @@ company_prompt = st.text_area(
139
  help="Enter a detailed description of the company culture, role requirements, and desired skills.",
140
  )
141
 
142
- # Show model selection in sidebar
143
- st.sidebar.header("Model Settings")
144
-
145
- # Model dropdowns - we're now only allowing one model of each type to be selected
146
- summarization_model = st.sidebar.selectbox(
147
- "Summarization Model",
148
- ["google/pegasus-xsum", "facebook/bart-large-cnn", "t5-small", "sshleifer/distilbart-cnn-12-6"],
149
- index=0,
150
- help="Select the model to use for summarizing the resume text."
151
- )
152
-
153
- similarity_model = st.sidebar.selectbox(
154
- "Similarity Model",
155
- ["sentence-transformers/all-MiniLM-L6-v2", "sentence-transformers/all-mpnet-base-v2",
156
- "sentence-transformers/paraphrase-MiniLM-L3-v2", "sentence-transformers/multi-qa-mpnet-base-dot-v1"],
157
- index=0,
158
- help="Select the model to use for comparing candidate summary with company profile."
159
- )
160
-
161
- # Reload models if changed
162
- if st.sidebar.button("Reload Models"):
163
- st.cache_resource.clear()
164
- models = load_models(summarization_model, similarity_model)
165
- st.sidebar.success("Models reloaded successfully!")
166
-
167
  # Process button
168
  if uploaded_file is not None and company_prompt and st.button("Analyze Resume"):
169
  with st.spinner("Processing..."):
@@ -173,10 +159,6 @@ if uploaded_file is not None and company_prompt and st.button("Analyze Resume"):
173
  if resume_text.startswith("Error") or resume_text == "Unsupported file type. Please upload a .docx or .txt file.":
174
  st.error(resume_text)
175
  else:
176
- # Display extracted text
177
- with st.expander("Extracted Text"):
178
- st.text(resume_text)
179
-
180
  # Generate summary
181
  summary, summarization_time = summarize_resume_text(resume_text, models)
182
 
 
7
  from scipy.spatial.distance import cosine
8
  import time
9
 
10
+ # Set page title and hide sidebar
11
+ st.set_page_config(
12
+ page_title="Resume Analyzer and Company Suitability Checker",
13
+ initial_sidebar_state="collapsed"
14
+ )
15
+
16
+ # Hide sidebar completely with custom CSS
17
+ st.markdown("""
18
+ <style>
19
+ [data-testid="collapsedControl"] {display: none;}
20
+ section[data-testid="stSidebar"] {display: none;}
21
+ </style>
22
+ """, unsafe_allow_html=True)
23
 
24
  #####################################
25
  # Preload Models
26
  #####################################
27
  @st.cache_resource(show_spinner=True)
28
+ def load_models():
29
  """Load models at startup"""
30
  with st.spinner("Loading AI models... This may take a minute on first run."):
31
  models = {}
32
  # Load summarization model
33
+ models['summarizer'] = pipeline("summarization", model="google/pegasus-xsum")
34
 
35
  # Load feature extraction model for similarity
36
+ models['feature_extractor'] = pipeline("feature-extraction", model="bert-base-uncased")
37
 
38
  return models
39
 
 
150
  help="Enter a detailed description of the company culture, role requirements, and desired skills.",
151
  )
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  # Process button
154
  if uploaded_file is not None and company_prompt and st.button("Analyze Resume"):
155
  with st.spinner("Processing..."):
 
159
  if resume_text.startswith("Error") or resume_text == "Unsupported file type. Please upload a .docx or .txt file.":
160
  st.error(resume_text)
161
  else:
 
 
 
 
162
  # Generate summary
163
  summary, summarization_time = summarize_resume_text(resume_text, models)
164