image_models.py 416 B

1234567891011121314151617
  1. from __future__ import annotations
  2. from .types import Client, ImageProvider
  3. from ..models import ModelUtils
  4. class ImageModels():
  5. def __init__(self, client):
  6. self.client = client
  7. self.models = ModelUtils.convert
  8. def get(self, name, default=None):
  9. model = self.models.get(name)
  10. if model and model.best_provider:
  11. return model.best_provider
  12. return default