OcrStep bileşeninde BASE_URL kontrolü güncellendi; Dockerfile ve docker-compose.yml dosyaları eklendi; geliştirme ve üretim ortamları için yapılandırmalar oluşturuldu.
This commit is contained in:
@@ -27,8 +27,11 @@ const OcrStep = () => {
|
||||
const abortRef = useRef(false);
|
||||
|
||||
const assetBase = useMemo(() => {
|
||||
const base = import.meta.env.BASE_URL ?? '/';
|
||||
return base.endsWith('/') ? base.slice(0, -1) : base;
|
||||
const rawBase = import.meta.env.BASE_URL ?? '/';
|
||||
if (rawBase === '.' || rawBase === './' || rawBase === '/') {
|
||||
return '';
|
||||
}
|
||||
return rawBase.endsWith('/') ? rawBase.slice(0, -1) : rawBase;
|
||||
}, []);
|
||||
const workerRef = useRef(null);
|
||||
const [workerReady, setWorkerReady] = useState(false);
|
||||
@@ -54,15 +57,18 @@ const OcrStep = () => {
|
||||
const initWorker = async () => {
|
||||
setWorkerReady(false);
|
||||
try {
|
||||
const workerOptions = {
|
||||
workerPath: paths.workerPath,
|
||||
corePath: paths.corePath,
|
||||
langPath: paths.langPath,
|
||||
};
|
||||
if (isDev) {
|
||||
workerOptions.logger = (m) => console.log('Tesseract:', m);
|
||||
}
|
||||
const worker = await Tesseract.createWorker(
|
||||
'tur', // Dil doğrudan belirt
|
||||
1, // OEM level (LSTM)
|
||||
{
|
||||
workerPath: paths.workerPath,
|
||||
corePath: paths.corePath,
|
||||
langPath: paths.langPath,
|
||||
logger: isDev ? (m) => console.log('Tesseract:', m) : undefined,
|
||||
},
|
||||
workerOptions,
|
||||
);
|
||||
|
||||
// Türkçe karakter tanımını iyileştir
|
||||
|
||||
Reference in New Issue
Block a user