face_restoration.py 494 B

12345678910111213141516171819
  1. from modules import shared
  2. class FaceRestoration:
  3. def name(self):
  4. return "None"
  5. def restore(self, np_image):
  6. return np_image
  7. def restore_faces(np_image):
  8. face_restorers = [x for x in shared.face_restorers if x.name() == shared.opts.face_restoration_model or shared.opts.face_restoration_model is None]
  9. if len(face_restorers) == 0:
  10. return np_image
  11. face_restorer = face_restorers[0]
  12. return face_restorer.restore(np_image)