mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-05-25 10:05:49 +08:00
26 lines
958 B
C#
26 lines
958 B
C#
using BetterGenshinImpact.Core.Recognition.ONNX;
|
|
using System.Collections.Concurrent;
|
|
using System.Globalization;
|
|
using BetterGenshinImpact.Core.Recognition.OCR.Paddle;
|
|
|
|
namespace BetterGenshinImpact.UnitTest.CoreTests.RecognitionTests.OCRTests
|
|
{
|
|
public class PaddleFixture
|
|
{
|
|
private readonly ConcurrentDictionary<string, PaddleOcrService> _paddleOcrServices = new();
|
|
|
|
public PaddleOcrService Get(string cultureInfoName = "zh-Hans")
|
|
{
|
|
return _paddleOcrServices.GetOrAdd(cultureInfoName, name =>
|
|
{
|
|
lock (_paddleOcrServices)
|
|
{
|
|
return new PaddleOcrService(
|
|
new BgiOnnxFactory(new FakeLogger<BgiOnnxFactory>()),
|
|
PaddleOcrService.PaddleOcrModelType.FromCultureInfo(new CultureInfo(name)) ??
|
|
PaddleOcrService.PaddleOcrModelType.V5);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
} |