ArthurGamaJorge commited on
Commit
ed404c8
1 Parent(s): 6f76ca6

Adicionar traceback para debug

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -3,10 +3,9 @@
3
  from fastapi import Body, FastAPI, UploadFile, File
4
  from fastapi.responses import JSONResponse
5
  from fastapi.middleware.cors import CORSMiddleware
6
- import numpy as np
7
- import cv2
8
  from detect import DengueDetector
9
  from predict import DenguePredictor
 
10
 
11
  # Inicializar detector e preditor
12
  detector = DengueDetector()
@@ -48,12 +47,13 @@ async def predict_dengue_route(payload: dict = Body(...)):
48
  if ibge_code is None or weeks_to_predict is None:
49
  raise ValueError("ibge_code e weeks_to_predict s茫o obrigat贸rios.")
50
 
51
- # Lazy loading: scalers carregados apenas quando necess谩rios
52
- result = predictor.predict(
53
- ibge_code,
54
- weeks_to_predict,
55
- )
56
  return result
57
 
58
  except Exception as e:
59
- return JSONResponse(status_code=500, content={"error": str(e)})
 
 
 
 
 
 
3
  from fastapi import Body, FastAPI, UploadFile, File
4
  from fastapi.responses import JSONResponse
5
  from fastapi.middleware.cors import CORSMiddleware
 
 
6
  from detect import DengueDetector
7
  from predict import DenguePredictor
8
+ import traceback
9
 
10
  # Inicializar detector e preditor
11
  detector = DengueDetector()
 
47
  if ibge_code is None or weeks_to_predict is None:
48
  raise ValueError("ibge_code e weeks_to_predict s茫o obrigat贸rios.")
49
 
50
+ result = predictor.predict(ibge_code, weeks_to_predict)
 
 
 
 
51
  return result
52
 
53
  except Exception as e:
54
+ tb_str = traceback.format_exc()
55
+ print(tb_str)
56
+ return JSONResponse(status_code=500, content={
57
+ "error": str(e),
58
+ "traceback": tb_str
59
+ })