forked from Monadical-SAS/minecraft_skin_generator
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Run_Inference_UI.sh
48 lines (38 loc) · 1.37 KB
/
Run_Inference_UI.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Detect OS and set paths accordingly
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
# Unix-like system
VENV_ACTIVATE="$(dirname "$0")/venv_ui/bin/activate"
else
# Windows system
VENV_ACTIVATE="$(dirname "$0")/venv_ui/Scripts/activate"
fi
REQUIREMENTS_FILE="$(dirname "$0")/Scripts/requirements_ui.txt"
RUN_SCRIPT_FILE="$(dirname "$0")/Scripts/Run_Inference_UI.py"
# Check if venv_ui folder exists in the root directory
if [ ! -d "$(dirname "$0")/venv_ui" ]; then
echo "Creating virtual environment..."
# Create a virtual environment named "venv_ui" in the root directory
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
python3 -m venv "$(dirname "$0")/venv_ui"
else
python -m venv "$(dirname "$0")/venv_ui"
fi
fi
echo "Activating the virtual environment..."
# Activate the virtual environment
source "$VENV_ACTIVATE"
echo "Installing requirements..."
# Install requirements inside the virtual environment
pip install -r "$REQUIREMENTS_FILE"
# Export the Hugging Face Read Token as an environment variable
export HUGGINGFACE_READ_TOKEN
echo "Running Python script..."
# Run your Python file here
python "$RUN_SCRIPT_FILE"
echo "Deactivating the virtual environment..."
# Deactivate the virtual environment
deactivate
echo "Script execution complete."
echo "Press Enter to exit..."
read