@echo off

REM Set the desired repository URL
set repository=https://github.com/FurkanGozukara/stable-diffusion-xl-demo

REM Extract the repository name from the URL
for %%I in ("%repository:/=" "%") do set "repoName=%%~nxI"

REM Remove any existing folder with the same repository name
if exist "%repoName%" (
    echo Removing existing folder "%repoName%"
    rd /s /q "%repoName%"
)

REM Clone the repository into the current directory
git clone %repository% "%repoName%"

cd "%repoName%"

REM Create virtual environment folder
echo composing venv
IF NOT EXIST venv (
    python -m venv venv
) ELSE (
    echo venv folder already exists, skipping making new venv...
)
call .\venv\Scripts\activate.bat

echo installing requirements 
REM Install packages from requirements.txt
pip install -r requirements2.txt

REM Show completion message
echo Virtual environment made and installed properly

REM Pause to keep the command prompt open
pause