Spaces:
Runtime error
Runtime error
sandrocalzada
commited on
Commit
•
6c13188
1
Parent(s):
adb1c6d
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def analyze_cv(cv_file, desired_role, expected_salary):
|
4 |
-
#
|
5 |
salary_ranges = {
|
6 |
"Desarrollador": (30000, 60000),
|
7 |
"Diseñador": (25000, 50000),
|
8 |
"Gerente": (40000, 80000)
|
9 |
}
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
-
cv_content = file.read().lower()
|
14 |
|
15 |
-
#
|
16 |
if desired_role.lower() in cv_content:
|
17 |
-
#
|
18 |
salary_range = salary_ranges.get(desired_role, (0, 0))
|
19 |
if salary_range[0] <= int(expected_salary) <= salary_range[1]:
|
20 |
result = "El candidato es elegible para la posición."
|
@@ -25,16 +24,16 @@ def analyze_cv(cv_file, desired_role, expected_salary):
|
|
25 |
|
26 |
return result
|
27 |
|
28 |
-
#
|
29 |
iface = gr.Interface(
|
30 |
fn=analyze_cv,
|
31 |
inputs=[
|
32 |
-
gr.
|
33 |
-
gr.
|
34 |
-
gr.
|
35 |
],
|
36 |
-
outputs=gr.
|
37 |
)
|
38 |
|
39 |
-
#
|
40 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
def analyze_cv(cv_file, desired_role, expected_salary):
|
4 |
+
# Define salary ranges for different roles (this is just an example)
|
5 |
salary_ranges = {
|
6 |
"Desarrollador": (30000, 60000),
|
7 |
"Diseñador": (25000, 50000),
|
8 |
"Gerente": (40000, 80000)
|
9 |
}
|
10 |
|
11 |
+
# Read the content of the CV
|
12 |
+
cv_content = cv_file.read().decode("utf-8").lower()
|
|
|
13 |
|
14 |
+
# Check if the desired role is mentioned in the CV
|
15 |
if desired_role.lower() in cv_content:
|
16 |
+
# Check if the expected salary is within the range for the role
|
17 |
salary_range = salary_ranges.get(desired_role, (0, 0))
|
18 |
if salary_range[0] <= int(expected_salary) <= salary_range[1]:
|
19 |
result = "El candidato es elegible para la posición."
|
|
|
24 |
|
25 |
return result
|
26 |
|
27 |
+
# Define the Gradio interface
|
28 |
iface = gr.Interface(
|
29 |
fn=analyze_cv,
|
30 |
inputs=[
|
31 |
+
gr.File(label="Sube tu CV"),
|
32 |
+
gr.Textbox(label="Nombre del rol o posición deseada"),
|
33 |
+
gr.Textbox(label="Salario esperado"),
|
34 |
],
|
35 |
+
outputs=gr.Textbox(label="Resultado de la elegibilidad"),
|
36 |
)
|
37 |
|
38 |
+
# Launch the application
|
39 |
iface.launch()
|