mrfirdauss commited on
Commit
7202869
·
verified ·
1 Parent(s): 8b9da68

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -26,11 +26,12 @@ async def extract(text: InsertedText):
26
 
27
 
28
  @app.post("/classify", response_model=ClassificationResult)
29
- async def classify(body:JobAndCV ):
30
  mininmal_start = 0
31
  maximal_end = 0
32
  positions = []
33
  userMajors = []
 
34
  if len(body.cv.experiences) > 0:
35
  mininmal_start = datetime.strptime(body.cv.experiences[0]['start'], "%Y-%m-%d").date() if body.cv.experiences[0].get('start') != None else datetime.today().date()
36
  maximal_end = datetime.strptime(body.cv.experiences[0]['end'], "%Y-%m-%d").date() if body.cv.experiences[0].get('end') != None else datetime.today().date()
@@ -42,14 +43,11 @@ async def classify(body:JobAndCV ):
42
  mininmal_start = datetime.strptime(exp['start'], "%Y-%m-%d").date()
43
  if datetime.strptime(exp['end'], "%Y-%m-%d").date() > maximal_end:
44
  maximal_end = datetime.strptime(exp['end'], "%Y-%m-%d").date()
45
- else:
46
- mininmal_start = 0
47
- maximal_end = 0
48
 
49
  for edu in body.cv.educations:
50
  userMajors.append(edu['major'])
51
 
52
- yoe = (maximal_end - mininmal_start).days//365
53
  cv = {
54
  "experiences": str(body.cv.experiences),
55
  "positions": str(positions),
 
26
 
27
 
28
  @app.post("/classify", response_model=ClassificationResult)
29
+ async def classify(body:JobAndCV):
30
  mininmal_start = 0
31
  maximal_end = 0
32
  positions = []
33
  userMajors = []
34
+ yoe = 0
35
  if len(body.cv.experiences) > 0:
36
  mininmal_start = datetime.strptime(body.cv.experiences[0]['start'], "%Y-%m-%d").date() if body.cv.experiences[0].get('start') != None else datetime.today().date()
37
  maximal_end = datetime.strptime(body.cv.experiences[0]['end'], "%Y-%m-%d").date() if body.cv.experiences[0].get('end') != None else datetime.today().date()
 
43
  mininmal_start = datetime.strptime(exp['start'], "%Y-%m-%d").date()
44
  if datetime.strptime(exp['end'], "%Y-%m-%d").date() > maximal_end:
45
  maximal_end = datetime.strptime(exp['end'], "%Y-%m-%d").date()
46
+ yoe = (maximal_end - mininmal_start).days//365
 
 
47
 
48
  for edu in body.cv.educations:
49
  userMajors.append(edu['major'])
50
 
 
51
  cv = {
52
  "experiences": str(body.cv.experiences),
53
  "positions": str(positions),