Spaces:
Build error
Build error
Merge pull request #2 from fsa-simpleqt/HuyDN
Browse filesPhase1/HuyDN: Edit function jd2text and text2tector
app/modules/question_retrieval/__init__.py
CHANGED
@@ -2,6 +2,7 @@ from fastapi import APIRouter, UploadFile, File
|
|
2 |
from typing import Annotated
|
3 |
|
4 |
from app.modules.question_retrieval.models.jd2text import jobdes2text
|
|
|
5 |
|
6 |
qtretrieval_router = APIRouter(prefix="/qtretrieval", tags=["qtretrieval"])
|
7 |
|
@@ -15,7 +16,10 @@ async def send_jd(txt_file: Annotated[UploadFile, File(..., description="The JD
|
|
15 |
try:
|
16 |
# read the txt file with format
|
17 |
jobdes = txt_file.file.read().decode("utf-8")
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
except Exception as e:
|
21 |
-
return {"message": "Error", "error":
|
|
|
2 |
from typing import Annotated
|
3 |
|
4 |
from app.modules.question_retrieval.models.jd2text import jobdes2text
|
5 |
+
from app.modules.question_retrieval.models.text2tector import text2vector
|
6 |
|
7 |
qtretrieval_router = APIRouter(prefix="/qtretrieval", tags=["qtretrieval"])
|
8 |
|
|
|
16 |
try:
|
17 |
# read the txt file with format
|
18 |
jobdes = txt_file.file.read().decode("utf-8")
|
19 |
+
sumaryjd_text = jobdes2text(jobdes)
|
20 |
+
print("sumaryjd_text: ", sumaryjd_text)
|
21 |
+
sumaryjd_vector = text2vector(sumaryjd_text)
|
22 |
+
print("sumaryjd_vector: ", sumaryjd_vector)
|
23 |
+
return {"message": "Send JD successfully"}
|
24 |
except Exception as e:
|
25 |
+
return {"message": "Error", "error": str(e)}
|
app/modules/question_retrieval/models/jd2text.py
CHANGED
@@ -39,4 +39,4 @@ def jobdes2text(jobdes):
|
|
39 |
|
40 |
result = chain.invoke(chat_message)
|
41 |
|
42 |
-
return result
|
|
|
39 |
|
40 |
result = chain.invoke(chat_message)
|
41 |
|
42 |
+
return result.content
|