Spaces:
Runtime error
Runtime error
# 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 | |