#!/bin/bash # Check if a filename has been provided if [ "$#" -ne 1 ]; then echo "Usage: $0 " exit 1 fi filename="$1" # Check if the file exists if [ ! -f "$filename" ]; then echo "Error: File does not exist." exit 1 fi # Assuming GLOBAL_API_KEY is exported in your environment if [ -z "$GLOBAL_API_KEY" ]; then echo "Error: GLOBAL_API_KEY is not set." exit 1 fi # Endpoint endpoint="https://api.sij.ai/speaksummary" # Make the request curl -X POST "$endpoint" \ -H "Authorization: Bearer $GLOBAL_API_KEY" \ -H "Content-Type: multipart/form-data" \ -F "file=@$filename" \ -o "response.wav" # Check if the output was saved successfully if [ -f "response.wav" ]; then echo "The summary has been processed and saved as 'response.wav'" else echo "Failed to save the summary." fi