Compare commits
14 Commits
ff0608292d
...
963b8d84e0
Author | SHA1 | Date |
---|---|---|
|
963b8d84e0 | |
|
ab8a1c82c1 | |
|
e1842ae0ba | |
|
989106e914 | |
|
5f2e54552c | |
|
d2794038f7 | |
|
521cad145d | |
|
3d8af5180d | |
|
28109e93bb | |
|
fc312516e3 | |
|
72049f3e91 | |
|
6cb5de01f8 | |
|
0bcf340217 | |
|
994a63c546 |
57
README.md
57
README.md
|
@ -134,12 +134,57 @@ Place these files in the "**models**" folder.
|
|||
We highly recommend using a `venv` to avoid issues.
|
||||
|
||||
|
||||
For Windows:
|
||||
```bash
|
||||
python -m venv venv
|
||||
venv\Scripts\activate
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
**For Windows:**
|
||||
|
||||
It is highly recommended to use Python 3.10 for Windows for best compatibility with all features and dependencies.
|
||||
|
||||
**Automated Setup (Recommended):**
|
||||
|
||||
1. **Run the setup script:**
|
||||
Double-click `setup_windows.bat` or run it from your command prompt:
|
||||
```batch
|
||||
setup_windows.bat
|
||||
```
|
||||
This script will:
|
||||
* Check if Python is in your PATH.
|
||||
* Warn if `ffmpeg` is not found (see "Manual Steps / Notes" below for ffmpeg help).
|
||||
* Create a virtual environment named `.venv` (consistent with macOS setup).
|
||||
* Activate the virtual environment for the script's session.
|
||||
* Upgrade pip.
|
||||
* Install Python packages from `requirements.txt`.
|
||||
Wait for the script to complete. It will pause at the end; press any key to close the window if you double-clicked it.
|
||||
|
||||
2. **Run the application:**
|
||||
After setup, use the provided `.bat` scripts to run the application. These scripts automatically activate the correct virtual environment:
|
||||
* `run_windows.bat`: Runs the application with the CPU execution provider by default. This is a good starting point if you don't have a dedicated GPU or are unsure.
|
||||
* `run-cuda.bat`: Runs with the CUDA (NVIDIA GPU) execution provider. Requires an NVIDIA GPU and CUDA Toolkit installed (see GPU Acceleration section).
|
||||
* `run-directml.bat`: Runs with the DirectML (AMD/Intel GPU on Windows) execution provider.
|
||||
|
||||
Example: Double-click `run_windows.bat` to launch the UI, or run from a command prompt:
|
||||
```batch
|
||||
run_windows.bat --source path\to\your_face.jpg --target path\to\video.mp4
|
||||
```
|
||||
|
||||
**Manual Steps / Notes:**
|
||||
|
||||
* **Python:** Ensure Python 3.10 is installed and added to your system's PATH. You can download it from [python.org](https://www.python.org/downloads/).
|
||||
* **ffmpeg:**
|
||||
* `ffmpeg` is required for video processing. The `setup_windows.bat` script will warn if it's not found in your PATH.
|
||||
* An easy way to install `ffmpeg` on Windows is to open PowerShell as Administrator and run:
|
||||
```powershell
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')); choco install ffmpeg -y
|
||||
```
|
||||
Alternatively, download from [ffmpeg.org](https://ffmpeg.org/download.html), extract the files, and add the `bin` folder (containing `ffmpeg.exe`) to your system's PATH environment variable. The original README also linked to a [YouTube guide](https://www.youtube.com/watch?v=OlNWCpFdVMA) or `iex (irm ffmpeg.tc.ht)` via PowerShell.
|
||||
* **Visual Studio Runtimes:** If you encounter errors during `pip install` for packages that compile C code (e.g., some scientific computing or image processing libraries), you might need the [Visual Studio Build Tools (or Runtimes)](https://visualstudio.microsoft.com/visual-cpp-build-tools/). Ensure "C++ build tools" (or similar workload) are selected during installation.
|
||||
* **Virtual Environment (Manual Alternative):** If you prefer to set up the virtual environment manually instead of using `setup_windows.bat`:
|
||||
```batch
|
||||
python -m venv .venv
|
||||
.venv\Scripts\activate.bat
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -r requirements.txt
|
||||
```
|
||||
(The new automated scripts use `.venv` as the folder name for consistency with the macOS setup).
|
||||
|
||||
For Linux:
|
||||
```bash
|
||||
# Ensure you use the installed Python 3.10
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"Source x Target Mapper": "Mapeador de fuente x destino",
|
||||
"select a source image": "Seleccionar imagen fuente",
|
||||
"Preview": "Vista previa",
|
||||
"select a target image or video": "elegir un video o una imagen fuente",
|
||||
"save image output file": "guardar imagen final",
|
||||
"save video output file": "guardar video final",
|
||||
"select a target image": "elegir una imagen objetiva",
|
||||
"source": "fuente",
|
||||
"Select a target": "Elegir un destino",
|
||||
"Select a face": "Elegir una cara",
|
||||
"Keep audio": "Mantener audio original",
|
||||
"Face Enhancer": "Potenciador de caras",
|
||||
"Many faces": "Varias caras",
|
||||
"Show FPS": "Mostrar fps",
|
||||
"Keep fps": "Mantener fps",
|
||||
"Keep frames": "Mantener frames",
|
||||
"Fix Blueish Cam": "Corregir tono azul de video",
|
||||
"Mouth Mask": "Máscara de boca",
|
||||
"Show Mouth Mask Box": "Mostrar área de la máscara de boca",
|
||||
"Start": "Iniciar",
|
||||
"Live": "En vivo",
|
||||
"Destroy": "Borrar",
|
||||
"Map faces": "Mapear caras",
|
||||
"Processing...": "Procesando...",
|
||||
"Processing succeed!": "¡Proceso terminado con éxito!",
|
||||
"Processing ignored!": "¡Procesamiento omitido!",
|
||||
"Failed to start camera": "No se pudo iniciar la cámara",
|
||||
"Please complete pop-up or close it.": "Complete o cierre el pop-up",
|
||||
"Getting unique faces": "Buscando caras únicas",
|
||||
"Please select a source image first": "Primero, seleccione una imagen fuente",
|
||||
"No faces found in target": "No se encontró una cara en el destino",
|
||||
"Add": "Agregar",
|
||||
"Clear": "Limpiar",
|
||||
"Submit": "Enviar",
|
||||
"Select source image": "Seleccionar imagen fuente",
|
||||
"Select target image": "Seleccionar imagen destino",
|
||||
"Please provide mapping!": "Por favor, proporcione un mapeo",
|
||||
"At least 1 source with target is required!": "Se requiere al menos una fuente con un destino.",
|
||||
"At least 1 source with target is required!": "Se requiere al menos una fuente con un destino.",
|
||||
"Face could not be detected in last upload!": "¡No se pudo encontrar una cara en el último video o imagen!",
|
||||
"Select Camera:": "Elegir cámara:",
|
||||
"All mappings cleared!": "¡Todos los mapeos fueron borrados!",
|
||||
"Mappings successfully submitted!": "Mapeos enviados con éxito!",
|
||||
"Source x Target Mapper is already open.": "El mapeador de fuente x destino ya está abierto."
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"Source x Target Mapper": "ប្រភប x បន្ថែម Mapper",
|
||||
"select a source image": "ជ្រើសរើសប្រភពរូបភាព",
|
||||
"Preview": "បង្ហាញ",
|
||||
"select a target image or video": "ជ្រើសរើសគោលដៅរូបភាពឬវីដេអូ",
|
||||
"save image output file": "រក្សាទុកលទ្ធផលឯកសាររូបភាព",
|
||||
"save video output file": "រក្សាទុកលទ្ធផលឯកសារវីដេអូ",
|
||||
"select a target image": "ជ្រើសរើសគោលដៅរូបភាព",
|
||||
"source": "ប្រភព",
|
||||
"Select a target": "ជ្រើសរើសគោលដៅ",
|
||||
"Select a face": "ជ្រើសរើសមុខ",
|
||||
"Keep audio": "រម្លងសម្លេង",
|
||||
"Face Enhancer": "ឧបករណ៍ពង្រឹងមុខ",
|
||||
"Many faces": "ទម្រង់មុខច្រើន",
|
||||
"Show FPS": "បង្ហាញ FPS",
|
||||
"Keep fps": "រម្លង fps",
|
||||
"Keep frames": "រម្លងទម្រង់",
|
||||
"Fix Blueish Cam": "ជួសជុល Cam Blueish",
|
||||
"Mouth Mask": "របាំងមាត់",
|
||||
"Show Mouth Mask Box": "បង្ហាញប្រអប់របាំងមាត់",
|
||||
"Start": "ចាប់ផ្ដើម",
|
||||
"Live": "ផ្សាយផ្ទាល់",
|
||||
"Destroy": "លុប",
|
||||
"Map faces": "ផែនទីមុខ",
|
||||
"Processing...": "កំពុងដំណើរការ...",
|
||||
"Processing succeed!": "ការដំណើរការទទួលបានជោគជ័យ!",
|
||||
"Processing ignored!": "ការដំណើរការមិនទទួលបានជោគជ័យ!",
|
||||
"Failed to start camera": "បរាជ័យដើម្បីចាប់ផ្ដើមបើកកាមេរ៉ា",
|
||||
"Please complete pop-up or close it.": "សូមបញ្ចប់ផ្ទាំងផុស ឬបិទវា.",
|
||||
"Getting unique faces": "ការចាប់ផ្ដើមទម្រង់មុខប្លែក",
|
||||
"Please select a source image first": "សូមជ្រើសរើសប្រភពរូបភាពដំបូង",
|
||||
"No faces found in target": "រកអត់ឃើញមុខនៅក្នុងគោលដៅ",
|
||||
"Add": "បន្ថែម",
|
||||
"Clear": "សម្អាត",
|
||||
"Submit": "បញ្ចូន",
|
||||
"Select source image": "ជ្រើសរើសប្រភពរូបភាព",
|
||||
"Select target image": "ជ្រើសរើសគោលដៅរូបភាព",
|
||||
"Please provide mapping!": "សូមផ្ដល់នៅផែនទី",
|
||||
"At least 1 source with target is required!": "ត្រូវការប្រភពយ៉ាងហោចណាស់ ១ ដែលមានគោលដៅ!",
|
||||
"Face could not be detected in last upload!": "មុខមិនអាចភ្ជាប់នៅក្នុងការបង្ហេាះចុងក្រោយ!",
|
||||
"Select Camera:": "ជ្រើសរើសកាមេរ៉ា",
|
||||
"All mappings cleared!": "ផែនទីទាំងអស់ត្រូវបានសម្អាត!",
|
||||
"Mappings successfully submitted!": "ផែនទីត្រូវបានបញ្ជូនជោគជ័យ!",
|
||||
"Source x Target Mapper is already open.": "ប្រភព x Target Mapper បានបើករួចហើយ។"
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"Source x Target Mapper": "Mapeador de Origem x Destino",
|
||||
"select an source image": "Escolha uma imagem de origem",
|
||||
"Preview": "Prévia",
|
||||
"select an target image or video": "Escolha uma imagem ou vídeo de destino",
|
||||
"save image output file": "Salvar imagem final",
|
||||
"save video output file": "Salvar vídeo final",
|
||||
"select an target image": "Escolha uma imagem de destino",
|
||||
"source": "Origem",
|
||||
"Select a target": "Escolha o destino",
|
||||
"Select a face": "Escolha um rosto",
|
||||
"Keep audio": "Manter o áudio original",
|
||||
"Face Enhancer": "Melhorar rosto",
|
||||
"Many faces": "Vários rostos",
|
||||
"Show FPS": "Mostrar FPS",
|
||||
"Keep fps": "Manter FPS",
|
||||
"Keep frames": "Manter frames",
|
||||
"Fix Blueish Cam": "Corrigir tom azulado da câmera",
|
||||
"Mouth Mask": "Máscara da boca",
|
||||
"Show Mouth Mask Box": "Mostrar área da máscara da boca",
|
||||
"Start": "Começar",
|
||||
"Live": "Ao vivo",
|
||||
"Destroy": "Destruir",
|
||||
"Map faces": "Mapear rostos",
|
||||
"Processing...": "Processando...",
|
||||
"Processing succeed!": "Tudo certo!",
|
||||
"Processing ignored!": "Processamento ignorado!",
|
||||
"Failed to start camera": "Não foi possível iniciar a câmera",
|
||||
"Please complete pop-up or close it.": "Finalize ou feche o pop-up",
|
||||
"Getting unique faces": "Buscando rostos diferentes",
|
||||
"Please select a source image first": "Selecione primeiro uma imagem de origem",
|
||||
"No faces found in target": "Nenhum rosto encontrado na imagem de destino",
|
||||
"Add": "Adicionar",
|
||||
"Clear": "Limpar",
|
||||
"Submit": "Enviar",
|
||||
"Select source image": "Escolha a imagem de origem",
|
||||
"Select target image": "Escolha a imagem de destino",
|
||||
"Please provide mapping!": "Você precisa realizar o mapeamento!",
|
||||
"Atleast 1 source with target is required!": "É necessária pelo menos uma origem com um destino!",
|
||||
"At least 1 source with target is required!": "É necessária pelo menos uma origem com um destino!",
|
||||
"Face could not be detected in last upload!": "Não conseguimos detectar o rosto na última imagem!",
|
||||
"Select Camera:": "Escolher câmera:",
|
||||
"All mappings cleared!": "Todos os mapeamentos foram removidos!",
|
||||
"Mappings successfully submitted!": "Mapeamentos enviados com sucesso!",
|
||||
"Source x Target Mapper is already open.": "O Mapeador de Origem x Destino já está aberto."
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"Source x Target Mapper": "Сопоставитель Источник x Цель",
|
||||
"select a source image": "выберите исходное изображение",
|
||||
"Preview": "Предпросмотр",
|
||||
"select a target image or video": "выберите целевое изображение или видео",
|
||||
"save image output file": "сохранить выходной файл изображения",
|
||||
"save video output file": "сохранить выходной файл видео",
|
||||
"select a target image": "выберите целевое изображение",
|
||||
"source": "источник",
|
||||
"Select a target": "Выберите целевое изображение",
|
||||
"Select a face": "Выберите лицо",
|
||||
"Keep audio": "Сохранить аудио",
|
||||
"Face Enhancer": "Улучшение лица",
|
||||
"Many faces": "Несколько лиц",
|
||||
"Show FPS": "Показать FPS",
|
||||
"Keep fps": "Сохранить FPS",
|
||||
"Keep frames": "Сохранить кадры",
|
||||
"Fix Blueish Cam": "Исправить синеву камеры",
|
||||
"Mouth Mask": "Маска рта",
|
||||
"Show Mouth Mask Box": "Показать рамку маски рта",
|
||||
"Start": "Старт",
|
||||
"Live": "В реальном времени",
|
||||
"Destroy": "Остановить",
|
||||
"Map faces": "Сопоставить лица",
|
||||
"Processing...": "Обработка...",
|
||||
"Processing succeed!": "Обработка успешна!",
|
||||
"Processing ignored!": "Обработка проигнорирована!",
|
||||
"Failed to start camera": "Не удалось запустить камеру",
|
||||
"Please complete pop-up or close it.": "Пожалуйста, заполните всплывающее окно или закройте его.",
|
||||
"Getting unique faces": "Получение уникальных лиц",
|
||||
"Please select a source image first": "Сначала выберите исходное изображение, пожалуйста",
|
||||
"No faces found in target": "В целевом изображении не найдено лиц",
|
||||
"Add": "Добавить",
|
||||
"Clear": "Очистить",
|
||||
"Submit": "Отправить",
|
||||
"Select source image": "Выбрать исходное изображение",
|
||||
"Select target image": "Выбрать целевое изображение",
|
||||
"Please provide mapping!": "Пожалуйста, укажите сопоставление!",
|
||||
"At least 1 source with target is required!": "Требуется хотя бы 1 источник с целью!",
|
||||
"Face could not be detected in last upload!": "Лицо не обнаружено в последнем загруженном изображении!",
|
||||
"Select Camera:": "Выберите камеру:",
|
||||
"All mappings cleared!": "Все сопоставления очищены!",
|
||||
"Mappings successfully submitted!": "Сопоставления успешно отправлены!",
|
||||
"Source x Target Mapper is already open.": "Сопоставитель Источник-Цель уже открыт."
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"Source x Target Mapper": "ตัวจับคู่ต้นทาง x ปลายทาง",
|
||||
"select a source image": "เลือกรูปภาพต้นฉบับ",
|
||||
"Preview": "ตัวอย่าง",
|
||||
"select a target image or video": "เลือกรูปภาพหรือวิดีโอเป้าหมาย",
|
||||
"save image output file": "บันทึกไฟล์รูปภาพ",
|
||||
"save video output file": "บันทึกไฟล์วิดีโอ",
|
||||
"select a target image": "เลือกรูปภาพเป้าหมาย",
|
||||
"source": "ต้นฉบับ",
|
||||
"Select a target": "เลือกเป้าหมาย",
|
||||
"Select a face": "เลือกใบหน้า",
|
||||
"Keep audio": "เก็บเสียง",
|
||||
"Face Enhancer": "ปรับปรุงใบหน้า",
|
||||
"Many faces": "หลายใบหน้า",
|
||||
"Show FPS": "แสดง FPS",
|
||||
"Keep fps": "คงค่า FPS",
|
||||
"Keep frames": "คงค่าเฟรม",
|
||||
"Fix Blueish Cam": "แก้ไขภาพอมฟ้าจากกล้อง",
|
||||
"Mouth Mask": "มาสก์ปาก",
|
||||
"Show Mouth Mask Box": "แสดงกรอบมาสก์ปาก",
|
||||
"Start": "เริ่ม",
|
||||
"Live": "สด",
|
||||
"Destroy": "หยุด",
|
||||
"Map faces": "จับคู่ใบหน้า",
|
||||
"Processing...": "กำลังประมวลผล...",
|
||||
"Processing succeed!": "ประมวลผลสำเร็จแล้ว!",
|
||||
"Processing ignored!": "การประมวลผลถูกละเว้น",
|
||||
"Failed to start camera": "ไม่สามารถเริ่มกล้องได้",
|
||||
"Please complete pop-up or close it.": "โปรดดำเนินการในป๊อปอัปให้เสร็จสิ้น หรือปิด",
|
||||
"Getting unique faces": "กำลังค้นหาใบหน้าที่ไม่ซ้ำกัน",
|
||||
"Please select a source image first": "โปรดเลือกภาพต้นฉบับก่อน",
|
||||
"No faces found in target": "ไม่พบใบหน้าในภาพเป้าหมาย",
|
||||
"Add": "เพิ่ม",
|
||||
"Clear": "ล้าง",
|
||||
"Submit": "ส่ง",
|
||||
"Select source image": "เลือกภาพต้นฉบับ",
|
||||
"Select target image": "เลือกภาพเป้าหมาย",
|
||||
"Please provide mapping!": "โปรดระบุการจับคู่!",
|
||||
"At least 1 source with target is required!": "ต้องมีการจับคู่ต้นฉบับกับเป้าหมายอย่างน้อย 1 คู่!",
|
||||
"Face could not be detected in last upload!": "ไม่สามารถตรวจพบใบหน้าในไฟล์อัปโหลดล่าสุด!",
|
||||
"Select Camera:": "เลือกกล้อง:",
|
||||
"All mappings cleared!": "ล้างการจับคู่ทั้งหมดแล้ว!",
|
||||
"Mappings successfully submitted!": "ส่งการจับคู่สำเร็จแล้ว!",
|
||||
"Source x Target Mapper is already open.": "ตัวจับคู่ต้นทาง x ปลายทาง เปิดอยู่แล้ว"
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
from typing import Any, List
|
||||
from typing import Any, List, Optional, Tuple
|
||||
import cv2
|
||||
import insightface
|
||||
import threading
|
||||
|
@ -72,8 +72,8 @@ def _prepare_warped_source_material_and_mask(
|
|||
source_face_obj: Face,
|
||||
source_frame_full: Frame,
|
||||
matrix: np.ndarray,
|
||||
dsize: tuple
|
||||
) -> tuple[Frame | None, Frame | None]:
|
||||
dsize: tuple # Built-in tuple is fine here for parameter type
|
||||
) -> Tuple[Optional[Frame], Optional[Frame]]:
|
||||
"""
|
||||
Prepares warped source material (full image) and a combined (face+hair) mask for blending.
|
||||
Returns (None, None) if essential masks cannot be generated.
|
||||
|
|
|
@ -1013,7 +1013,6 @@ def create_webcam_preview(camera_index: int):
|
|||
temp_frame, PREVIEW.winfo_width(), PREVIEW.winfo_height()
|
||||
)
|
||||
|
||||
if not modules.globals.map_faces:
|
||||
if not modules.globals.map_faces:
|
||||
# Case 1: map_faces is False - source_face_obj_for_cam and source_frame_full_for_cam are pre-loaded
|
||||
if source_face_obj_for_cam and source_frame_full_for_cam is not None: # Check if valid after pre-loading
|
||||
|
|
|
@ -50,7 +50,17 @@ class VideoCapturer:
|
|||
continue
|
||||
else:
|
||||
# Unix-like systems (Linux/Mac) capture method
|
||||
self.cap = cv2.VideoCapture(self.device_index)
|
||||
if platform.system() == "Darwin": # macOS
|
||||
print("INFO: Attempting to use cv2.CAP_AVFOUNDATION for macOS camera.")
|
||||
self.cap = cv2.VideoCapture(self.device_index, cv2.CAP_AVFOUNDATION)
|
||||
if not self.cap or not self.cap.isOpened():
|
||||
print("WARN: cv2.CAP_AVFOUNDATION failed to open camera. Trying default backend for macOS.")
|
||||
# Release the failed attempt before trying again
|
||||
if self.cap:
|
||||
self.cap.release()
|
||||
self.cap = cv2.VideoCapture(self.device_index) # Fallback to default
|
||||
else: # Other Unix-like systems (e.g., Linux)
|
||||
self.cap = cv2.VideoCapture(self.device_index)
|
||||
|
||||
if not self.cap or not self.cap.isOpened():
|
||||
raise RuntimeError("Failed to open camera")
|
||||
|
|
17
run-cuda.bat
17
run-cuda.bat
|
@ -1 +1,16 @@
|
|||
python run.py --execution-provider cuda
|
||||
@echo off
|
||||
set VENV_DIR=.venv
|
||||
|
||||
:: Check if virtual environment exists
|
||||
if not exist "%VENV_DIR%\Scripts\activate.bat" (
|
||||
echo Virtual environment '%VENV_DIR%' not found.
|
||||
echo Please run setup_windows.bat first.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Activating virtual environment...
|
||||
call "%VENV_DIR%\Scripts\activate.bat"
|
||||
|
||||
echo Starting the application with CUDA execution provider...
|
||||
python run.py --execution-provider cuda %*
|
||||
|
|
|
@ -1 +1,16 @@
|
|||
python run.py --execution-provider dml
|
||||
@echo off
|
||||
set VENV_DIR=.venv
|
||||
|
||||
:: Check if virtual environment exists
|
||||
if not exist "%VENV_DIR%\Scripts\activate.bat" (
|
||||
echo Virtual environment '%VENV_DIR%' not found.
|
||||
echo Please run setup_windows.bat first.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Activating virtual environment...
|
||||
call "%VENV_DIR%\Scripts\activate.bat"
|
||||
|
||||
echo Starting the application with DirectML execution provider...
|
||||
python run.py --execution-provider dml %*
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
@echo off
|
||||
set VENV_DIR=.venv
|
||||
|
||||
:: Check if virtual environment exists
|
||||
if not exist "%VENV_DIR%\Scripts\activate.bat" (
|
||||
echo Virtual environment '%VENV_DIR%' not found.
|
||||
echo Please run setup_windows.bat first to create the environment and install dependencies.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Activating virtual environment...
|
||||
call "%VENV_DIR%\Scripts\activate.bat"
|
||||
|
||||
echo Starting the application with CPU execution provider...
|
||||
:: Passes all arguments passed to this script to run.py
|
||||
python run.py --execution-provider cpu %*
|
||||
|
||||
:: Optional: Deactivate after script finishes
|
||||
:: call deactivate
|
|
@ -0,0 +1,79 @@
|
|||
@echo off
|
||||
echo Starting Windows setup...
|
||||
|
||||
:: 1. Check for Python
|
||||
echo Checking for Python...
|
||||
python --version >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Python could not be found in your PATH.
|
||||
echo Please install Python 3 (3.10 or higher recommended) and ensure it's added to your PATH.
|
||||
echo You can download Python from https://www.python.org/downloads/
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Optional: Check Python version (e.g., >= 3.9 or >=3.10).
|
||||
:: This is a bit more complex in pure batch. For now, rely on user having a modern Python 3.
|
||||
:: The README will recommend 3.10.
|
||||
echo Found Python:
|
||||
python --version
|
||||
|
||||
:: 2. Check for ffmpeg (informational)
|
||||
echo Checking for ffmpeg...
|
||||
ffmpeg -version >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo WARNING: ffmpeg could not be found in your PATH. This program requires ffmpeg for video processing.
|
||||
echo Please download ffmpeg from https://ffmpeg.org/download.html and add it to your system's PATH.
|
||||
echo (The README.md contains a link for a potentially easier ffmpeg install method using a PowerShell command)
|
||||
echo Continuing with setup, but video processing might fail later.
|
||||
pause
|
||||
) else (
|
||||
echo ffmpeg found.
|
||||
)
|
||||
|
||||
:: 3. Define virtual environment directory
|
||||
set VENV_DIR=.venv
|
||||
|
||||
:: 4. Create virtual environment
|
||||
if exist "%VENV_DIR%\Scripts\activate.bat" (
|
||||
echo Virtual environment '%VENV_DIR%' already exists. Skipping creation.
|
||||
) else (
|
||||
echo Creating virtual environment in '%VENV_DIR%'...
|
||||
python -m venv "%VENV_DIR%"
|
||||
if errorlevel 1 (
|
||||
echo Failed to create virtual environment. Please check your Python installation.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
:: 5. Activate virtual environment (for this script's session)
|
||||
echo Activating virtual environment...
|
||||
call "%VENV_DIR%\Scripts\activate.bat"
|
||||
|
||||
:: 6. Upgrade pip
|
||||
echo Upgrading pip...
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
:: 7. Install requirements
|
||||
echo Installing requirements from requirements.txt...
|
||||
if exist "requirements.txt" (
|
||||
python -m pip install -r requirements.txt
|
||||
) else (
|
||||
echo ERROR: requirements.txt not found. Cannot install dependencies.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo Setup complete!
|
||||
echo.
|
||||
echo To activate the virtual environment in your command prompt, run:
|
||||
echo %VENV_DIR%\Scripts\activate.bat
|
||||
echo.
|
||||
echo After activating, you can run the application using:
|
||||
echo python run.py [arguments]
|
||||
echo Or use one of the run-*.bat scripts (e.g., run-cuda.bat, run_windows.bat).
|
||||
echo.
|
||||
pause
|
||||
exit /b 0
|
Loading…
Reference in New Issue