#!/bin/bash while true; do echo "Checking and installing required packages..." # Install required packages pip install --upgrade pip pip install torch torchvision pip install diffusers==0.27.2 pip install gradio==3.1.5 pip install moviepy pip install opencv-python-headless==4.5.5.64 pip install huggingface-hub # Run the Gradio interface python ~/ai-dreams-x/gradio_interface.py # Check if the last command was successful if [ $? -eq 0 ]; then echo "Gradio interface is running successfully." break else echo "An error occurred. Retrying in 5 seconds..." sleep 5 fi done