mirror of
https://github.com/barkeser2002/ocr-img.git
synced 2026-09-25 01:09:56 +03:00
101 lines
2.8 KiB
Batchfile
101 lines
2.8 KiB
Batchfile
@echo off
|
|
chcp 65001 >nul
|
|
echo ==========================================
|
|
echo OCR PROJESI OTOMATIK KURULUM
|
|
echo ==========================================
|
|
echo.
|
|
|
|
REM Python klasoru ve surumu tanimla
|
|
set PYTHON_VERSION=3.11.9
|
|
set PYTHON_DIR=%~dp0python
|
|
set PYTHON_EXE=%PYTHON_DIR%\python.exe
|
|
set PYTHON_INSTALLER=python-%PYTHON_VERSION%-amd64.exe
|
|
|
|
REM Mevcut Python'u kontrol et
|
|
if exist "%PYTHON_EXE%" (
|
|
echo Python bulundu: %PYTHON_DIR%
|
|
goto :install_packages
|
|
)
|
|
|
|
REM Sistem Python'unu kontrol et
|
|
python --version >nul 2>&1
|
|
if not errorlevel 1 (
|
|
echo Sistem Python bulundu, yerel kopya olusturuluyor...
|
|
echo Bu daha guvenli ve tasinabilir bir cozumdur
|
|
goto :download_python
|
|
)
|
|
|
|
echo Python bulunamadi, otomatik indiriliyor...
|
|
|
|
:download_python
|
|
echo.
|
|
echo Python bulunamadi, otomatik indiriliyor...
|
|
echo Surum: %PYTHON_VERSION%
|
|
echo.
|
|
|
|
REM Python installer'i indir
|
|
if not exist "%PYTHON_INSTALLER%" (
|
|
echo Python indiriliyor... Yaklasik 25MB
|
|
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri 'https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER%' -OutFile '%PYTHON_INSTALLER%' -UserAgent 'Mozilla/5.0'}"
|
|
if not exist "%PYTHON_INSTALLER%" (
|
|
echo HATA: Python indirilemedi!
|
|
echo Manuel kurulum icin: https://www.python.org/downloads/
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo Python basariyla indirildi!
|
|
)
|
|
|
|
REM Python'u sessiz kurulum portable
|
|
echo Python kuruluyor... Sessiz kurulum
|
|
"%PYTHON_INSTALLER%" /quiet InstallAllUsers=0 PrependPath=0 Include_test=0 SimpleInstall=1 SimpleInstallDescription="OCR Projesi icin Python" TargetDir="%PYTHON_DIR%"
|
|
|
|
REM Kurulumun basarili olup olmadigini kontrol et
|
|
timeout /t 10 /nobreak >nul
|
|
if not exist "%PYTHON_EXE%" (
|
|
echo HATA: Python kurulumu basarisiz!
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
echo Python basariyla kuruldu: %PYTHON_DIR%
|
|
|
|
REM Installer dosyasini sil
|
|
if exist "%PYTHON_INSTALLER%" del "%PYTHON_INSTALLER%"
|
|
|
|
:install_packages
|
|
echo.
|
|
echo pip guncelleniyor...
|
|
"%PYTHON_EXE%" -m pip install --upgrade pip --quiet --no-warn-script-location
|
|
|
|
echo.
|
|
echo Gerekli paketler yukleniyor... Bu islem 2-5 dakika surebilir
|
|
echo - PyTorch GPU destegi
|
|
echo - EasyOCR
|
|
echo - OpenCV
|
|
echo - ReportLab
|
|
echo - PIL/Pillow
|
|
echo.
|
|
|
|
"%PYTHON_EXE%" -m pip install -r requirements.txt --quiet --no-warn-script-location
|
|
|
|
REM Klasorleri olustur
|
|
echo Klasorler olusturuluyor...
|
|
if not exist "images" mkdir images
|
|
if not exist "out-txt" mkdir "out-txt"
|
|
if not exist "out-pdf" mkdir "out-pdf"
|
|
|
|
echo.
|
|
echo ============================================
|
|
echo Kurulum tamamlandi!
|
|
echo ============================================
|
|
echo.
|
|
echo Kullanim:
|
|
echo 1. Resimlerinizi 'images' klasorune koyun
|
|
echo 2. 'ocr_calistir.bat' dosyasini calistirin
|
|
echo.
|
|
echo NOT: Ilk calistirmada OCR modelleri indirilecek
|
|
echo ve islem uzun surebilir.
|
|
echo.
|
|
pause
|