#!/bin/bash

if [ "$1" = "" ]; then
	echo "Usage: $0 [-p/-s/-t] file"
	exit
fi

if [ "$1" = "-p" ]; then # Predict
	if [ "$2" = "" ]; then
		echo "Must specify a URL image."
		exit
	fi
	imageUrl=$(imgbin "$2")
	echo "$imageURL"
	data='{"inputs": [{"data": {"image": {"url": "'
	data=$(echo "$data$imageUrl")
	data=$(echo "$data\"}}}]}")
	response=$(curl --silent -X POST -H 'Authorization: Bearer gkYM6GFJjKszSUSLDIkr6rEobu4ltf' -H "Content-Type: application/json" -d "$data" https://api.clarifai.com/v2/models/aaa03c23b3724a16a56b629203edc62c/outputs)
	echo $response
	echo "$response" | awk -F "name\":\"" {'print $3'} | awk -F "\"" {'print $1'}
	exit
fi


if [ "$1" = "-s" ]; then # Search
	echo "Search API"
	
	exit
fi


if [ "$1" = "-t" ]; then # Train
	echo "Training API"
	
	exit
fi
