Explorar el Código

lancement depuis le shel

main
Alex hace 2 semanas
padre
commit
32b88aa9b8
Se han modificado 1 ficheros con 44 adiciones y 0 borrados
  1. 44
    0
      run.bat

+ 44
- 0
run.bat Ver fichero

@@ -0,0 +1,44 @@
@echo off
setlocal

set OLLAMA_PORT=11434
set OLLAMA_HOST=localhost

REM Récupérer le répertoire courant
set CURRENT_DIR=%cd%

REM Chemin vers l'environnement virtuel Python (relatif au répertoire courant)
set VENV_PATH=%CURRENT_DIR%\venv

REM Chemin vers votre script principal (relatif au répertoire courant)
set MAIN_SCRIPT_PATH=%CURRENT_DIR%\main.py

REM Activer l'environnement virtuel Python
call %VENV_PATH%\Scripts\activate.bat

REM Lancer la compilation du modèle LLM pour Ollama
ollama create traductionUkrainienVersFrancais -f .\Modelfile

:: 1. Vérifie si le processus ollama.exe est en cours d'exécution
tasklist | find "ollama.exe" >nul
if %ERRORLEVEL% equ 0 (
echo [OK] Le processus Ollama est en cours d'exécution.
) else (
echo [ERREUR] Ollama n'est pas lancé.
pause
exit /b 1
)

:: 2. Vérifie si le port 11434 est ouvert en local
echo Verification du port %OLLAMA_PORT% sur %OLLAMA_HOST%...
powershell -Command "$tcp = New-Object System.Net.Sockets.TcpClient; $connect = $tcp.ConnectAsync('%OLLAMA_HOST%', %OLLAMA_PORT%); $connect.Wait(1000); if ($tcp.Connected) { echo 'Port %OLLAMA_PORT% ouvert en local.'; $tcp.Close() } else { echo 'Port %OLLAMA_PORT% non accessible en local.'; exit 1 }"
if %ERRORLEVEL% neq 0 (
echo [ERREUR] Le port %OLLAMA_PORT% n'est pas accessible en local.
pause
exit /b 1
)

REM Exécuter le script principal
python %MAIN_SCRIPT_PATH%

endlocal

Cargando…
Cancelar
Guardar