YoussefMorad1 commited on
Commit
e49cb3c
·
1 Parent(s): 2ab90aa

handled empty skill lists.

Browse files
main.py CHANGED
@@ -7,3 +7,7 @@ app = FastAPI()
7
  # Mount the two apps under different routes
8
  app.mount("/skills", skills_app)
9
  app.mount("/similarity", similarity_app)
 
 
 
 
 
7
  # Mount the two apps under different routes
8
  app.mount("/skills", skills_app)
9
  app.mount("/similarity", similarity_app)
10
+
11
+ # if __name__ == "__main__":
12
+ # import uvicorn
13
+ # uvicorn.run("main:app", host="0.0.0.0", port=7860, reload=True)
semantic_similarity/semantic_similarity.py CHANGED
@@ -31,6 +31,13 @@ def match_skills(req: SkillsMatchingRequest):
31
  user_skills = req.userSkills
32
  threshold = req.similarityThreshold
33
 
 
 
 
 
 
 
 
34
  job_texts = [j.skill for j in job_skills]
35
  user_texts = [u.skill for u in user_skills]
36
 
@@ -105,7 +112,6 @@ def match_projects_skills(req: ProjectsMatchingRequest):
105
 
106
  return MatchingProjectsResponse(allAnalyzedProjects=matched_projects)
107
 
108
-
109
  # uvicorn semantic_similarity:app --host 0.0.0.0 --port 8001
110
  # if __name__ == "__main__":
111
  # uvicorn.run(app, host="0.0.0.0", port=8001, reload=False)
 
31
  user_skills = req.userSkills
32
  threshold = req.similarityThreshold
33
 
34
+ if not job_skills or not user_skills:
35
+ return MatchingSkillsResponse(
36
+ matchedSkills=[],
37
+ unmatchedJobSkills=job_skills,
38
+ unmatchedUserSkills=user_skills
39
+ )
40
+
41
  job_texts = [j.skill for j in job_skills]
42
  user_texts = [u.skill for u in user_skills]
43
 
 
112
 
113
  return MatchingProjectsResponse(allAnalyzedProjects=matched_projects)
114
 
 
115
  # uvicorn semantic_similarity:app --host 0.0.0.0 --port 8001
116
  # if __name__ == "__main__":
117
  # uvicorn.run(app, host="0.0.0.0", port=8001, reload=False)