#!/bin/bash # Variables API_KEY="36d8624a99dd4ff2b9bddb7f52c48a15" INPUT_FILE="./blah.png" OUTPUT_FILE="blaho.png" response=$(curl \ -F "image=@${INPUT_FILE}" \ -H "api-key: eca50643-c007-462a-ab9c-a635a9c335e6" \ https://api.deepai.org/api/torch-srgan) # Step 2: Parse the output URL from the response output_url=$(echo "$response" | grep -oP '(?<="output_url": ")[^"]*') # Step 3: Check if the URL was retrieved if [ -z "$output_url" ]; then echo "Error: Unable to retrieve the output URL." echo "Response: $response" exit 1 fi echo "Upscaled image URL: $output_url" # Step 4: Download the upscaled image curl -s -o "${OUTPUT_FILE}" "${output_url}" if [ $? -eq 0 ]; then echo "Upscaled image saved as ${OUTPUT_FILE}" else echo "Error: Failed to download the upscaled image." fi