forked from Monadical-SAS/minecraft_skin_generator
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Run_Inference_NO_UI.sh
75 lines (60 loc) · 2.36 KB
/
Run_Inference_NO_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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/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_no_ui.txt"
# Check if venv_ui folder exists in the root directory
if [ ! -d "$(dirname "$0")/venv_no_ui" ]; then
echo "Creating virtual environment..."
# Create a virtual environment named "venv_ui" in the root directory
if [[ "$OSTYPE" == "linux"* || "$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"
echo "Running Python script..."
# Run your Python file here
#!/bin/bash
read -p "Enter your prompt: " prompt
read -p "Enter the Stable Diffusion Model Version (2/xl, xl understands better prompts): " sd_model
read -p "Enter the number of inference steps (more integer value = better but longer process): " num_inference_steps
read -p "Enter the guidance scale (how much the output adheres to the prompt): " guidance_scale
read -p "Enter the model precision type (fp16 for faster or fp32 for more precision): " model_precision_type
read -p "Enter the seed (an integer or 0 for random): " seed
read -p "Enter the output filename with .png extension: " filename
read -p "See the skin also as a 3D Model? (y/n): " model_3d
read -p "Produce Verbose (detailed) Output? (y/n): " verbose
if [[ "$sd_model" == "2" ]]; then
sd_model_version="minecraft-skins"
else
sd_model_version="minecraft-skins-sdxl"
fi
if [[ "$verbose" == "y" ]]; then
verbose_flag="--verbose"
else
verbose_flag=""
fi
if [[ "$model_3d" == "y" ]]; then
model_3d_flag="--model_3d"
else
model_3d_flag=""
fi
python Scripts/"$sd_model_version".py "$prompt" "$num_inference_steps" "$guidance_scale" "$model_precision_type" "$seed" "$filename" "$model_3d_flag" "$verbose_flag"
echo "Deactivating the virtual environment..."
# Deactivate the virtual environment
deactivate
echo "Script execution complete."
echo "Press Enter to exit..."
read