Files
OrpaonVision/OrpaonVision.SiteApp/Runtime/Services/MockInferenceService.cs
2026-04-06 22:04:05 +08:00

29 lines
867 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using OrpaonVision.Core.Results;
using OrpaonVision.SiteApp.Runtime.Contracts;
namespace OrpaonVision.SiteApp.Runtime.Services
{
/// <summary>
/// 推理服务模拟实现MVP 阶段)。
/// </summary>
public sealed class MockInferenceService : IInferenceService
{
/// <inheritdoc />
public Result<InferenceResultDto> Predict(CameraFrameDto frame)
{
var tick = DateTime.UtcNow.Ticks;
var label = tick % 2 == 0 ? "OK" : "NG_MISALIGN";
var confidence = label == "OK" ? 0.92m : 0.78m;
var result = new InferenceResultDto
{
FrameId = frame.FrameId,
Label = label,
Confidence = confidence
};
return Result<InferenceResultDto>.Success(result, message: "推理完成。");
}
}
}