Spaces:
Runtime error
Runtime error
File size: 1,466 Bytes
32d4b56 |
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 |
#!/bin/bash
# Ensure dependencies are installed
pip install accelerate moviepy numpy
# Move cache to the right location if needed
python -c "from transformers.utils import move_cache; move_cache()"
<<<<<<< HEAD
# Function to check and download the model
check_and_download_model() {
local model_name=$1
python -c "
import sys
from diffusers import StableDiffusionPipeline
import torch
try:
StableDiffusionPipeline.from_pretrained('${model_name}', torch_dtype=torch.float16)
sys.exit(0)
except Exception as e:
print(f'Error: {e}', file=sys.stderr)
sys.exit(1)
"
}
# Function to ensure setup is complete
ensure_setup() {
install_packages
local models=("stabilityai/stable-diffusion-2-1-base" "CompVis/stable-diffusion-v1-4" "runwayml/stable-diffusion-v1-5")
for model in "${models[@]}"
do
echo "Checking model: ${model}"
if check_and_download_model ${model}; then
echo "Model ${model} is ready."
export MODEL_NAME=${model}
return 0
=======
# Install necessary Python packages
pip install transformers gradio torch
# Retry loop for launching the Gradio interface
while true; do
python gradio_interface_extended.py
if [ $? -eq 0 ]; then
echo "Gradio interface started successfully."
break
>>>>>>> cd0bb518 (Update render.yaml and post_deploy.sh for enhanced deployment)
else
echo "Gradio interface failed to start. Retrying in 10 seconds..."
sleep 10
fi
done
|