sandrocalzada commited on
Commit
db02cf1
1 Parent(s): b0e3d64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -23
app.py CHANGED
@@ -1,32 +1,22 @@
1
-
2
  import io
 
 
3
 
4
  def read_docx(file_bytes):
5
-
6
  file_like_object = io.BytesIO(file_bytes)
7
  document = Document(file_like_object)
8
  doc_text = [paragraph.text for paragraph in document.paragraphs]
9
-
10
-
11
-
12
-
13
-
14
  return '\n'.join(doc_text).lower()
15
 
16
  def analyze_cv(cv_file, desired_role, expected_salary):
17
-
18
  salary_ranges = {
19
  "desarrollador": (30000, 60000),
20
  "diseñador": (25000, 50000),
21
  "gerente": (40000, 80000)
22
  }
23
-
24
-
25
  cv_content = read_docx(cv_file)
26
  desired_role = desired_role.lower()
27
  if desired_role in cv_content:
28
-
29
-
30
  salary_range = salary_ranges.get(desired_role, (0, 0))
31
  try:
32
  expected_salary = int(expected_salary)
@@ -38,10 +28,8 @@ def analyze_cv(cv_file, desired_role, expected_salary):
38
  result = "Por favor, ingrese un valor numérico válido para la expectativa salarial."
39
  else:
40
  result = "El candidato no es elegible debido a la falta de experiencia relevante."
41
-
42
  return result
43
 
44
-
45
  iface = gr.Interface(
46
  fn=analyze_cv,
47
  inputs=[
@@ -51,12 +39,14 @@ iface = gr.Interface(
51
  ],
52
  outputs=gr.Textbox(label="Resultado de la elegibilidad"),
53
  title="Análisis automático de CV",
54
- .gr-file { border-color: #007BFF; }
55
- .gr-button { background-color: #007BFF; color: white; }
56
- .gr-output-text { font-size: 16px; }
57
- """
58
-
59
- )
60
-
61
- # Launch the application with share=True to create a public link
62
- iface.launch(share=True)
 
 
 
 
1
  import io
2
+ from docx import Document
3
+ import gradio as gr
4
 
5
  def read_docx(file_bytes):
 
6
  file_like_object = io.BytesIO(file_bytes)
7
  document = Document(file_like_object)
8
  doc_text = [paragraph.text for paragraph in document.paragraphs]
 
 
 
 
 
9
  return '\n'.join(doc_text).lower()
10
 
11
  def analyze_cv(cv_file, desired_role, expected_salary):
 
12
  salary_ranges = {
13
  "desarrollador": (30000, 60000),
14
  "diseñador": (25000, 50000),
15
  "gerente": (40000, 80000)
16
  }
 
 
17
  cv_content = read_docx(cv_file)
18
  desired_role = desired_role.lower()
19
  if desired_role in cv_content:
 
 
20
  salary_range = salary_ranges.get(desired_role, (0, 0))
21
  try:
22
  expected_salary = int(expected_salary)
 
28
  result = "Por favor, ingrese un valor numérico válido para la expectativa salarial."
29
  else:
30
  result = "El candidato no es elegible debido a la falta de experiencia relevante."
 
31
  return result
32
 
 
33
  iface = gr.Interface(
34
  fn=analyze_cv,
35
  inputs=[
 
39
  ],
40
  outputs=gr.Textbox(label="Resultado de la elegibilidad"),
41
  title="Análisis automático de CV",
42
+ css="""
43
+ .gr-file {
44
+ border-color: #007BFF;
45
+ }
46
+ .gr-button {
47
+ background-color: #007BFF;
48
+ color: white;
49
+ }
50
+ .gr-output-text {
51
+ font-size: 16px;
52
+ }