Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -34,7 +34,7 @@ except Exception as e:
|
|
| 34 |
|
| 35 |
|
| 36 |
try:
|
| 37 |
-
from src.cv_parsing_agents import
|
| 38 |
CV_PARSING_AVAILABLE = True
|
| 39 |
logger.info("✅ CV Parsing disponible")
|
| 40 |
except Exception as e:
|
|
@@ -136,9 +136,6 @@ async def health_check():
|
|
| 136 |
@app.post("/parse-cv/", tags=["CV Parsing"])
|
| 137 |
async def parse_cv(file: UploadFile = File(...)):
|
| 138 |
"""Analyse un CV PDF et extrait les informations structurées."""
|
| 139 |
-
if not CV_PARSING_AVAILABLE:
|
| 140 |
-
return create_fallback_cv_data() if create_fallback_cv_data else {"error": "Service de parsing indisponible"}
|
| 141 |
-
|
| 142 |
if file.content_type != "application/pdf":
|
| 143 |
raise HTTPException(status_code=400, detail="Fichier PDF requis")
|
| 144 |
|
|
@@ -151,10 +148,6 @@ async def parse_cv(file: UploadFile = File(...)):
|
|
| 151 |
|
| 152 |
cv_agent = CvParserAgent(pdf_path=tmp_path)
|
| 153 |
parsed_data = await run_in_threadpool(cv_agent.process)
|
| 154 |
-
|
| 155 |
-
if not parsed_data and create_fallback_cv_data:
|
| 156 |
-
parsed_data = create_fallback_cv_data(tmp_path)
|
| 157 |
-
|
| 158 |
if SCORING_AVAILABLE and ContextualScoringEngine and parsed_data:
|
| 159 |
try:
|
| 160 |
scoring_engine = ContextualScoringEngine(parsed_data)
|
|
@@ -168,8 +161,6 @@ async def parse_cv(file: UploadFile = File(...)):
|
|
| 168 |
|
| 169 |
except Exception as e:
|
| 170 |
logger.error(f"Erreur parsing CV: {e}")
|
| 171 |
-
if create_fallback_cv_data:
|
| 172 |
-
return create_fallback_cv_data(tmp_path)
|
| 173 |
raise HTTPException(status_code=500, detail=str(e))
|
| 174 |
|
| 175 |
finally:
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
try:
|
| 37 |
+
from src.cv_parsing_agents import OptimizedCvParserAgent, create_fallback_cv_data
|
| 38 |
CV_PARSING_AVAILABLE = True
|
| 39 |
logger.info("✅ CV Parsing disponible")
|
| 40 |
except Exception as e:
|
|
|
|
| 136 |
@app.post("/parse-cv/", tags=["CV Parsing"])
|
| 137 |
async def parse_cv(file: UploadFile = File(...)):
|
| 138 |
"""Analyse un CV PDF et extrait les informations structurées."""
|
|
|
|
|
|
|
|
|
|
| 139 |
if file.content_type != "application/pdf":
|
| 140 |
raise HTTPException(status_code=400, detail="Fichier PDF requis")
|
| 141 |
|
|
|
|
| 148 |
|
| 149 |
cv_agent = CvParserAgent(pdf_path=tmp_path)
|
| 150 |
parsed_data = await run_in_threadpool(cv_agent.process)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
if SCORING_AVAILABLE and ContextualScoringEngine and parsed_data:
|
| 152 |
try:
|
| 153 |
scoring_engine = ContextualScoringEngine(parsed_data)
|
|
|
|
| 161 |
|
| 162 |
except Exception as e:
|
| 163 |
logger.error(f"Erreur parsing CV: {e}")
|
|
|
|
|
|
|
| 164 |
raise HTTPException(status_code=500, detail=str(e))
|
| 165 |
|
| 166 |
finally:
|