Update app.py
Browse files
app.py
CHANGED
|
@@ -15,14 +15,6 @@ def generate_job_database() -> List[Dict]:
|
|
| 15 |
"skills": ["Python", "Java", "JavaScript", "Git", "Agile", "Problem Solving"]},
|
| 16 |
{"title": "Data Scientist", "desc": "Analyze complex data to extract business insights",
|
| 17 |
"skills": ["Python", "R", "Machine Learning", "SQL", "Statistics", "Pandas"]},
|
| 18 |
-
{"title": "DevOps Engineer", "desc": "Manage infrastructure and deployment pipelines",
|
| 19 |
-
"skills": ["AWS", "Docker", "Kubernetes", "Linux", "Python", "Terraform"]},
|
| 20 |
-
{"title": "Frontend Developer", "desc": "Create user interfaces and web experiences",
|
| 21 |
-
"skills": ["JavaScript", "React", "CSS", "HTML", "TypeScript", "Responsive Design"]},
|
| 22 |
-
{"title": "Backend Developer", "desc": "Build server-side applications and APIs",
|
| 23 |
-
"skills": ["Python", "Node.js", "Django", "PostgreSQL", "REST APIs", "MongoDB"]},
|
| 24 |
-
{"title": "Mobile Developer", "desc": "Develop applications for mobile platforms",
|
| 25 |
-
"skills": ["React Native", "Swift", "Kotlin", "Flutter", "iOS", "Android"]},
|
| 26 |
],
|
| 27 |
"Healthcare": [
|
| 28 |
{"title": "Registered Nurse", "desc": "Provide patient care and medical support",
|
|
@@ -126,20 +118,22 @@ def recommend_jobs(user_skills, top_k=5):
|
|
| 126 |
return top_jobs[['title', 'description', 'requirements', 'experience_level', 'category', 'location']]
|
| 127 |
|
| 128 |
# ------------------------------
|
| 129 |
-
# 4. Gradio Interface
|
| 130 |
# ------------------------------
|
| 131 |
def gradio_interface(skills_text):
|
| 132 |
user_skills = [skill.strip() for skill in skills_text.split(",")]
|
| 133 |
recommended = recommend_jobs(user_skills)
|
| 134 |
return recommended.to_dict(orient="records")
|
| 135 |
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
|
|
|
|
|
|
| 143 |
|
| 144 |
if __name__ == "__main__":
|
| 145 |
app.launch()
|
|
|
|
| 15 |
"skills": ["Python", "Java", "JavaScript", "Git", "Agile", "Problem Solving"]},
|
| 16 |
{"title": "Data Scientist", "desc": "Analyze complex data to extract business insights",
|
| 17 |
"skills": ["Python", "R", "Machine Learning", "SQL", "Statistics", "Pandas"]},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
],
|
| 19 |
"Healthcare": [
|
| 20 |
{"title": "Registered Nurse", "desc": "Provide patient care and medical support",
|
|
|
|
| 118 |
return top_jobs[['title', 'description', 'requirements', 'experience_level', 'category', 'location']]
|
| 119 |
|
| 120 |
# ------------------------------
|
| 121 |
+
# 4. Gradio Interface (v4.44.0 compatible)
|
| 122 |
# ------------------------------
|
| 123 |
def gradio_interface(skills_text):
|
| 124 |
user_skills = [skill.strip() for skill in skills_text.split(",")]
|
| 125 |
recommended = recommend_jobs(user_skills)
|
| 126 |
return recommended.to_dict(orient="records")
|
| 127 |
|
| 128 |
+
with gr.Blocks() as app:
|
| 129 |
+
gr.Markdown("# AI Job Finder")
|
| 130 |
+
gr.Markdown("Enter your skills (comma-separated) to find the best matching jobs!")
|
| 131 |
+
|
| 132 |
+
skills_input = gr.Textbox(lines=2, placeholder="Python, SQL, Machine Learning")
|
| 133 |
+
results_output = gr.Dataframe(headers=["Title", "Description", "Skills", "Experience", "Category", "Location"])
|
| 134 |
+
|
| 135 |
+
btn = gr.Button("Find Jobs")
|
| 136 |
+
btn.click(fn=gradio_interface, inputs=skills_input, outputs=results_output)
|
| 137 |
|
| 138 |
if __name__ == "__main__":
|
| 139 |
app.launch()
|