|
|
import gradio as gr |
|
|
import json |
|
|
import random |
|
|
|
|
|
|
|
|
def ml_model_evaluate(application_text): |
|
|
|
|
|
keywords = ["experience", "Python", "ML", "AI", "certification"] |
|
|
score = sum(1 for word in keywords if word.lower() in application_text.lower()) |
|
|
return score >= 3 |
|
|
|
|
|
|
|
|
def process_application(user_id, application_text): |
|
|
|
|
|
try: |
|
|
with open("applications.json", "r") as file: |
|
|
applications = json.load(file) |
|
|
except FileNotFoundError: |
|
|
applications = {} |
|
|
|
|
|
if str(user_id) in applications: |
|
|
return f"⚠️ You have already applied. Please wait for approval." |
|
|
|
|
|
|
|
|
approved = ml_model_evaluate(application_text) |
|
|
|
|
|
if approved: |
|
|
applications[str(user_id)] = "Approved" |
|
|
with open("applications.json", "w") as file: |
|
|
json.dump(applications, file) |
|
|
return f"✅ Application Approved! You are eligible for job postings." |
|
|
else: |
|
|
return f"❌ Application Rejected. Improve details and resubmit." |
|
|
|
|
|
|
|
|
iface = gr.Interface( |
|
|
fn=process_application, |
|
|
inputs=["text", "text"], |
|
|
outputs="text", |
|
|
title="AI Job Application Approval System", |
|
|
description="Submit your job application. If everything is correct, it will be approved automatically!", |
|
|
examples=[["2345", "I have experience in AI, Python, and ML."]], |
|
|
) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
iface.launch() |
|
|
|