import gradio as gr def analyze_cv(cv_file, desired_role, expected_salary): # Define salary ranges for different roles (this is just an example) salary_ranges = { "Desarrollador": (30000, 60000), "Diseñador": (25000, 50000), "Gerente": (40000, 80000) } # Read the content of the CV cv_content = cv_file.read().decode("utf-8").lower() # Check if the desired role is mentioned in the CV if desired_role.lower() in cv_content: # Check if the expected salary is within the range for the role salary_range = salary_ranges.get(desired_role, (0, 0)) if salary_range[0] <= int(expected_salary) <= salary_range[1]: result = "El candidato es elegible para la posición." else: result = "El candidato no es elegible debido a las expectativas salariales." else: result = "El candidato no es elegible debido a la falta de experiencia relevante." return result # Define the Gradio interface with aesthetic enhancements iface = gr.Interface( fn=analyze_cv, inputs=[ gr.File(label="Sube un CV"), gr.Textbox(label="Nombre del rol o posición a cubrir", placeholder="Ejemplo: Desarrollador BI"), gr.Textbox(label="Expectativa salarial", placeholder="Ejemplo: 5000"), ], outputs=gr.Textbox(label="Resultado de la elegibilidad"), title=" Candidate autoscreen ", description="Esta aplicación analiza un CV para determinar la elegibilidad para un rol específico en base la experiencia y expectativas salariales. Por favor, proporciona el CV, el rol deseado y la expectativa salarial.", theme="dark", # Example theme css=""" body { font-family: 'Arial'; } .gr-input-text { border-color: #007BFF; } .gr-file { border-color: #007BFF; } .gr-button { background-color: #007BFF; color: white; } .gr-output-text { font-size: 16px; } """ ) # Launch the application iface.launch()