hg / startup.sh
victorgg's picture
Create startup.sh
a8f9381 verified
#!/bin/bash
# Set the model name and URL
MODEL_NAME="reswapper-429500.pth" # Or the name of your model file
MODEL_URL="https://huggingface.co/somanchiu/reswapper/resolve/main/reswapper-429500.pth" # Replace with your model's URL
# Check if the model already exists. If so, skip the download
if [ ! -f "$MODEL_NAME" ]; then
echo "Downloading model $MODEL_NAME from $MODEL_URL..."
wget "$MODEL_URL" -O "$MODEL_NAME"
if [ $? -eq 0 ]; then # Check wget exit code (0 means success)
echo "Model $MODEL_NAME downloaded successfully."
else
echo "Error downloading model $MODEL_NAME. Check the URL and network connection."
exit 1 # Exit the script with an error code
fi
else
echo "Model $MODEL_NAME already exists. Skipping download."
fi
# (Optional) Download other files if needed - follow the same pattern as above:
# OTHER_FILE="other_file.txt"
# OTHER_URL="https://example.com/other_file.txt"
# if [ ! -f "$OTHER_FILE" ]; then
# wget "$OTHER_URL" -O "$OTHER_FILE"
# fi
# Start your Gradio app
echo "Starting Gradio app..."
python app.py