SivaMallikarjun/Robust-Approval-System
0
1import gradio as gr2import json3import random4 5# Sample ML Model Simulation6def ml_model_evaluate(application_text):7 # Simulating ML-based approval (Adjust as per real model)8 keywords = ["experience", "Python", "ML", "AI", "certification"]9 score = sum(1 for word in keywords if word.lower() in application_text.lower())10 return score >= 3 # Approve if at least 3 keywords match11 12# Job Application Processing Function13def process_application(user_id, application_text):14 # Check if the user exists (simulated with JSON storage)15 try:16 with open("applications.json", "r") as file:17 applications = json.load(file)18 except FileNotFoundError:19 applications = {}20 21 if str(user_id) in applications:22 return f"⚠️ You have already applied. Please wait for approval."23 24 # ML Model Decision25 approved = ml_model_evaluate(application_text)26 27 if approved:28 applications[str(user_id)] = "Approved"29 with open("applications.json", "w") as file:30 json.dump(applications, file)31 return f"✅ Application Approved! You are eligible for job postings."32 else:33 return f"❌ Application Rejected. Improve details and resubmit."34 35# Gradio UI36iface = gr.Interface(37 fn=process_application,38 inputs=["text", "text"],39 outputs="text",40 title="AI Job Application Approval System",41 description="Submit your job application. If everything is correct, it will be approved automatically!",42 examples=[["2345", "I have experience in AI, Python, and ML."]],43)44 45if __name__ == "__main__":46 iface.launch()47 