Bur3hani commited on
Commit
2c78b67
·
verified ·
1 Parent(s): 67ad25d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -126,7 +126,6 @@ def get_text_embeddings(text):
126
  else: return np.mean([token.vector for token in doc if token.has_vector], axis=0) if [token.vector for token in doc if token.has_vector] else np.zeros(nlp.vocab.vectors.shape[1])
127
 
128
  def calculate_cosine_similarity(vec1, vec2):
129
- # This check prevents errors if one of the vectors is all zeros.
130
  if np.all(vec1 == 0) or np.all(vec2 == 0):
131
  return 0.0
132
  vec1 = vec1.reshape(1, -1)
@@ -333,9 +332,9 @@ with gr.Blocks(theme=gr.themes.Soft(), title="CV-Job Match Analyzer") as demo:
333
  """
334
  )
335
 
336
- # --- NEW GRID LAYOUT ---
337
- with gr.Grid(2):
338
- with gr.Column(): # First column for inputs
339
  gr.Markdown("## **1. Your CV**")
340
  cv_file_obj = gr.File(label="Upload CV (PDF, DOCX, TXT)", file_types=[".pdf", ".docx", ".txt"])
341
  cv_text_input = gr.Textbox(label="Or paste CV text here (overrides file upload)", lines=10, placeholder="Paste your CV content here...")
@@ -345,15 +344,13 @@ with gr.Blocks(theme=gr.themes.Soft(), title="CV-Job Match Analyzer") as demo:
345
  analyze_button = gr.Button("✨ Analyze CV Match ✨", variant="primary", scale=1)
346
  clear_button = gr.ClearButton([cv_file_obj, cv_text_input, jd_text_input], scale=1)
347
 
348
- with gr.Column(): # Second column for outputs
349
  output_html = gr.HTML(label="Analysis Report")
350
  gr.Markdown("## **📊 Visual Insights**")
351
  output_overall_plot = gr.Plot(label="Overall Match Score")
352
  output_skill_plot = gr.Plot(label="Skill Match Breakdown")
353
  output_keywords_plot = gr.Plot(label="Top Keywords")
354
 
355
- # --- END OF GRID LAYOUT ---
356
-
357
  analyze_button.click(
358
  fn=analyze_cv_match,
359
  inputs=[cv_file_obj, cv_text_input, jd_text_input],
 
126
  else: return np.mean([token.vector for token in doc if token.has_vector], axis=0) if [token.vector for token in doc if token.has_vector] else np.zeros(nlp.vocab.vectors.shape[1])
127
 
128
  def calculate_cosine_similarity(vec1, vec2):
 
129
  if np.all(vec1 == 0) or np.all(vec2 == 0):
130
  return 0.0
131
  vec1 = vec1.reshape(1, -1)
 
332
  """
333
  )
334
 
335
+ # Using gr.Row and gr.Column for compatibility with older Gradio versions
336
+ with gr.Row():
337
+ with gr.Column(scale=1):
338
  gr.Markdown("## **1. Your CV**")
339
  cv_file_obj = gr.File(label="Upload CV (PDF, DOCX, TXT)", file_types=[".pdf", ".docx", ".txt"])
340
  cv_text_input = gr.Textbox(label="Or paste CV text here (overrides file upload)", lines=10, placeholder="Paste your CV content here...")
 
344
  analyze_button = gr.Button("✨ Analyze CV Match ✨", variant="primary", scale=1)
345
  clear_button = gr.ClearButton([cv_file_obj, cv_text_input, jd_text_input], scale=1)
346
 
347
+ with gr.Column(scale=2):
348
  output_html = gr.HTML(label="Analysis Report")
349
  gr.Markdown("## **📊 Visual Insights**")
350
  output_overall_plot = gr.Plot(label="Overall Match Score")
351
  output_skill_plot = gr.Plot(label="Skill Match Breakdown")
352
  output_keywords_plot = gr.Plot(label="Top Keywords")
353
 
 
 
354
  analyze_button.click(
355
  fn=analyze_cv_match,
356
  inputs=[cv_file_obj, cv_text_input, jd_text_input],