Spaces:
Sleeping
Sleeping
| from dependency_injector import containers, providers | |
| from app.client.futabus_client import FutabusClient | |
| from app.repositories.trip_repository import TripRepository | |
| from app.resolvers.location_resolver import LocationResolver | |
| from app.services.location_service import LocationService | |
| from app.services.time_service import TimeService | |
| from app.services.trip_service import TripService | |
| from app.services.user_service import UserService | |
| from app.ner.services.ner import NER | |
| class Container(containers.DeclarativeContainer): | |
| wiring_config = containers.WiringConfiguration( | |
| modules=[ | |
| "app.api.v1.trip", | |
| "app.api.v1.user", | |
| "app.api.v1.location", | |
| "app.api.v1.time", | |
| ] | |
| ) | |
| ner_model = providers.Singleton(NER) | |
| futabus_client = providers.Singleton(FutabusClient) | |
| location_service = providers.Factory( | |
| LocationService, | |
| client=futabus_client, | |
| ) | |
| location_resolver = providers.Factory( | |
| LocationResolver, location_service=location_service | |
| ) | |
| # NER model (singleton nếu model lớn) | |
| trip_repository = providers.Factory(TripRepository, client=futabus_client) | |
| trip_service = providers.Factory( | |
| TripService, | |
| trip_repository=trip_repository, | |
| futabus_client=futabus_client, | |
| location_resolver=location_resolver, | |
| ) | |
| time_service = providers.Factory( | |
| TimeService, | |
| ) | |
| user_service = providers.Factory(UserService, model=ner_model) | |