@echo off

git clone https://github.com/williamyang1991/Rerender_A_Video

cd Rerender_A_Video

cd deps

git clone https://github.com/lllyasviel/ControlNet

git clone https://github.com/SingleZombie/ebsynth

git clone https://github.com/haofeixu/gmflow

cd ..
cd ..

REM Move install2.py into the Rerender_A_Video folder
move /Y install2.py Rerender_A_Video

REM Try to move ebsynth.exe and ebsynth.dll into the Rerender_A_Video\deps\ebsynth\bin folder
IF EXIST ebsynth.exe (
    move /Y ebsynth.exe Rerender_A_Video\deps\ebsynth\bin
) ELSE (
    echo ebsynth.exe not found. You need to compile your own ebsynth exe.
)
IF EXIST ebsynth.dll (
    move /Y ebsynth.dll Rerender_A_Video\deps\ebsynth\bin
) ELSE (
    echo ebsynth.dll not found. You need to compile your own ebsynth exe.
)

REM Move sd_model_cfg.py into the Rerender_A_Video folder
move /Y sd_model_cfg.py Rerender_A_Video

cd Rerender_A_Video

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 
pip install -r requirements.txt

pip uninstall --yes torch torchvision torchaudio

python install2.py

pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117

pip install xformers==0.0.16

pip uninstall --yes gradio

pip install gradio==3.44.3

pip uninstall keras-nightly

REM Show completion message
echo Virtual environment made and installed properly

REM Pause to keep the command prompt open
pause