import { MACHINE_LEARNING_URL } from '@app/common'; import { IMachineLearningRepository, MachineLearningInput } from '@app/domain'; import { Injectable } from '@nestjs/common'; import axios from 'axios'; const client = axios.create({ baseURL: MACHINE_LEARNING_URL }); @Injectable() export class MachineLearningRepository implements IMachineLearningRepository { tagImage(input: MachineLearningInput): Promise { return client.post('/image-classifier/tag-image', input).then((res) => res.data); } detectObjects(input: MachineLearningInput): Promise { return client.post('/object-detection/detect-object', input).then((res) => res.data); } }