From 91003f66991bdc4fd462951b2d48e0781c0cbb80 Mon Sep 17 00:00:00 2001 From: adminBR Date: Mon, 16 Dec 2024 17:14:30 -0300 Subject: [PATCH] Added windows single click script with venv, changed fastapi requirement to fix runtime error --- requirements.txt | 2 +- run-windows.bat | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 run-windows.bat diff --git a/requirements.txt b/requirements.txt index 03d6acd..b95e2d5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -fastapi +fastapi[standard] faster_whisper torch \ No newline at end of file diff --git a/run-windows.bat b/run-windows.bat new file mode 100644 index 0000000..2cb3ea9 --- /dev/null +++ b/run-windows.bat @@ -0,0 +1,43 @@ +@echo off +setlocal + +:: Check if venv directory exists +if not exist venv ( + echo Virtual environment not found. Creating new environment... + python -m venv venv + + :: Check if venv creation was successful + if errorlevel 1 ( + echo Failed to create virtual environment. Please check if Python is installed correctly. + pause + exit /b 1 + ) + + :: Activate the virtual environment + call venv\Scripts\activate + + :: Check if requirements.txt exists + if exist requirements.txt ( + echo Installing requirements... + pip install -r requirements.txt + + if errorlevel 1 ( + echo Failed to install requirements. + pause + exit /b 1 + ) + ) else ( + echo Warning: requirements.txt not found. Skipping package installation. + ) +) else ( + echo Virtual environment found. Activating... + call venv\Scripts\activate +) + +:: Run FastAPI application +echo Starting FastAPI application... +fastapi run .\main.py + +:: Deactivate virtual environment on exit +deactivate +endlocal \ No newline at end of file