spjasper commited on
Commit
8356322
·
verified ·
1 Parent(s): 2dd7387

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import os
2
  import json
3
  import tempfile
4
- import fitz
5
  import numpy as np
6
  import pandas as pd
7
  import gradio as gr
@@ -216,20 +216,27 @@ def construir_tabla_habilidades(df, analisis):
216
  for _, row in df.iterrows():
217
  cubiertas = set(row["habilidades_detectadas"])
218
  faltantes = [h for h in habilidades if h not in cubiertas]
 
219
 
220
  fila = {
221
  "archivo": row["archivo"],
222
  "seniority_cv": row["seniority_cv"],
223
  "clasificacion": row["clasificacion"],
224
- "brecha_habilidades": ", ".join(faltantes) if faltantes else "ninguna"
 
 
225
  }
226
 
 
227
  for h in habilidades:
228
  fila[h] = "✔" if h in cubiertas else "—"
229
 
230
  filas.append(fila)
231
 
232
- return pd.DataFrame(filas)
 
 
 
233
 
234
  # ======================================================
235
  # PREGUNTAS DE EVALUACION
@@ -293,6 +300,9 @@ def procesar_drive(api_key, rol, folder_id):
293
  df = pd.DataFrame(filas).sort_values("fit_score", ascending=False)
294
  tabla_habilidades = construir_tabla_habilidades(df, analisis)
295
 
 
 
 
296
  return df, tabla_habilidades, analisis
297
 
298
  # ======================================================
 
1
  import os
2
  import json
3
  import tempfile
4
+ import fitz # PyMuPDF
5
  import numpy as np
6
  import pandas as pd
7
  import gradio as gr
 
216
  for _, row in df.iterrows():
217
  cubiertas = set(row["habilidades_detectadas"])
218
  faltantes = [h for h in habilidades if h not in cubiertas]
219
+ cobertura = round(100 * len(cubiertas) / len(habilidades), 1)
220
 
221
  fila = {
222
  "archivo": row["archivo"],
223
  "seniority_cv": row["seniority_cv"],
224
  "clasificacion": row["clasificacion"],
225
+ "brecha_habilidades": ", ".join(faltantes) if faltantes else "ninguna",
226
+ "cobertura_habilidades": f"{cobertura}%",
227
+ "habilidades_detectadas_listado": ", ".join(row["habilidades_detectadas"])
228
  }
229
 
230
+ # Columnas individuales de habilidades ✔ / —
231
  for h in habilidades:
232
  fila[h] = "✔" if h in cubiertas else "—"
233
 
234
  filas.append(fila)
235
 
236
+ tabla = pd.DataFrame(filas)
237
+ # Ordenar por fit score descendente
238
+ tabla = tabla.merge(df[["archivo", "fit_score"]], on="archivo").sort_values("fit_score", ascending=False)
239
+ return tabla
240
 
241
  # ======================================================
242
  # PREGUNTAS DE EVALUACION
 
300
  df = pd.DataFrame(filas).sort_values("fit_score", ascending=False)
301
  tabla_habilidades = construir_tabla_habilidades(df, analisis)
302
 
303
+ # Exportar a Excel
304
+ tabla_habilidades.to_excel("comparacion_habilidades.xlsx", index=False)
305
+
306
  return df, tabla_habilidades, analisis
307
 
308
  # ======================================================