__init__.py 491 B

12345678910111213141516
  1. from .init_sqlalhemy import db, init_databases
  2. from flask import Flask
  3. import paddlex as pdx
  4. def init_plugins(app:Flask):
  5. init_databases(app)
  6. init_paddle(app)
  7. def init_paddle(app):
  8. with app.app_context():
  9. use_gpu=True
  10. if not pdx.device.is_compiled_with_cuda():
  11. print("PaddlePaddle is not compiled with CUDA. CPU will be used.")
  12. use_gpu = False
  13. app.pdx_model = pdx.deploy.Predictor('./core/net/inference_model', use_gpu=use_gpu)