prediction.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import {axios} from '../utils/request'
  2. import {MODEL_MODULE, PREDICTION_MODULE} from "./_prefix";
  3. import {MOCK} from "./_prefix";
  4. /**
  5. * 使用模型预测 POST /model/use
  6. * @param modelId
  7. * @param fileId
  8. * @returns
  9. */
  10. export const use = async payload =>{
  11. const {modelId, fileInfoId, userId}=payload;
  12. const res=await axios.post(
  13. `${PREDICTION_MODULE}/predict?modelId=${modelId}&fileInfoId=${fileInfoId}&userId=${userId}`
  14. );
  15. // const res=await axios.post(`${MOCK}/ml/predictions/predict:modelId=1&fileInfoId=2`);
  16. return res;
  17. }
  18. /**
  19. * 获取某一个模型下的预测结果 GET
  20. * @param userId
  21. * @returns
  22. */
  23. export const getPrediction = async payload => {
  24. const{ modelId, userId } = payload;
  25. const res = await axios.get(`${PREDICTION_MODULE}/models/${modelId}`, {params: {userId: userId}})
  26. // const res = await axios.get(`${MOCK}/ml/predictions/models/:modelId`)
  27. return res
  28. }
  29. /**
  30. * 获取某用户的预测结果 GET
  31. * @param userId
  32. * @returns
  33. */
  34. export const getPredictionAll = async payload => {
  35. const{ userId } = payload;
  36. const res = await axios.get(`${PREDICTION_MODULE}`, {params: {userId: userId}})
  37. return res
  38. }
  39. /**
  40. * 获取预测结果详情 GET
  41. * @param modelId
  42. * @returns
  43. */
  44. export const getPredictionDetail = async payload => {
  45. const{ predictionId } = payload;
  46. // const res = await axios.get(`${MODEL_MODULE}/get/all/dl`, {params: {modelId: modelId}})
  47. const res = await axios.get(`${MOCK}/ml/predictions/:predictionId`)
  48. return res
  49. }