-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_codes.py
42 lines (34 loc) · 1.21 KB
/
main_codes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from fastapi import FastAPI, HTTPException
import find_jobs
import clean_text
import calculate_score
import calculate_score_v2
import calculate_score_v3
import json
from pydantic import BaseModel
app = FastAPI()
class PredictRequest(BaseModel):
job_title: str
job_location: str
job_search_number: float
resume: str
@app.post("/predict")
async def predict(request: PredictRequest):
try:
job_title = request.job_title
job_location = request.job_location
job_search_number = request.job_search_number
resume = request.resume
# İş açıklamalarını bul
job_descriptions = find_jobs.send_requests_for_job_post(job_title, job_location,job_search_number)
# Eşleşme skorunu hesapla
# score = calculate_score.match_results(resume, job_descriptions)
# score = calculate_score_v2.match_results(resume, job_descriptions)
score = calculate_score_v3.match_results(resume, job_descriptions)
# Sonucu geri gönder
return {"score": score}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="127.0.0.1", port=8000)