Ammar-Abdelhady-ai commited on
Commit
f254531
·
1 Parent(s): b5ce145

Add application file

Browse files
Files changed (1) hide show
  1. main.py +4 -5
main.py CHANGED
@@ -65,16 +65,15 @@ async def read_root():
65
  return {"Hello": "World, Project name is : CV Description"}
66
 
67
  @app.post("/prediction")
68
- async def detect(cv: UploadFile, number_of_jobs: int):
69
-
70
  if (type(number_of_jobs) != int) or (number_of_jobs < 1) or (number_of_jobs > df.shape[0]):
71
  raise HTTPException(
72
- status_code=415, detail = f"Please enter the number of jobs you want as an ' integer from 1 to {int(df.shape[0]) - 1} '."
73
  )
74
 
75
- if cv.filename.split(".")[-1] not in ("pdf") :
76
  raise HTTPException(
77
- status_code=415, detail="Please inter PDF file "
78
  )
79
 
80
 
 
65
  return {"Hello": "World, Project name is : CV Description"}
66
 
67
  @app.post("/prediction")
68
+ async def detect(cv: UploadFile = File(...), number_of_jobs: int = Form(...)):
 
69
  if (type(number_of_jobs) != int) or (number_of_jobs < 1) or (number_of_jobs > df.shape[0]):
70
  raise HTTPException(
71
+ status_code=415, detail=f"Please enter the number of jobs as an integer from 1 to {int(df.shape[0]) - 1}."
72
  )
73
 
74
+ if cv.filename.split(".")[-1] not in ("pdf"):
75
  raise HTTPException(
76
+ status_code=415, detail="Please upload a PDF file."
77
  )
78
 
79