SystemErrorWang / White-box-Cartoonization

Official tensorflow implementation for CVPR2020 paper “Learning to Cartoonize Using White-box Cartoon Representations”
3.96k stars 737 forks source link

Question about API and Curl #70

Open vincetota opened 3 years ago

vincetota commented 3 years ago

Please can someone help me to fix this issue? I'm trying to use API to cartoonize an image

This is the Curl php code I'm using... but output is always empty...

$pars=array(
    'file_type' => 'image',
     'source' => '@' . 'https://www.smsstar.it/cartoon/source.jpg;type=image/jpeg'
);

$curlSES=curl_init(); 
curl_setopt($curlSES,CURLOPT_URL,"https://master-white-box-cartoonization-psi1104.endpoint.ainize.ai/predict");
curl_setopt($curlSES,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curlSES, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data", "Accept:image/jpg"));
curl_setopt($curlSES, CURLOPT_POST, true);
curl_setopt($curlSES, CURLOPT_POSTFIELDS,$pars);
curl_setopt($curlSES, CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($curlSES, CURLOPT_TIMEOUT,30);

$result=curl_exec($curlSES);

curl_close($curlSES);

$source = base64_encode(file_get_contents("https://www.smsstar.it/cartoon/source.jpg"));
$imageData = base64_encode(file_get_contents($result));

echo '<img width="600px" src="data:image/jpeg;base64,'.$source.'">';
echo " ";
echo '<img width="600px" src="data:image/jpeg;base64,'.$imageData.'">';
jainmonica123 commented 1 year ago

I am using this api but response is showing like : "no healthy upstream"

Please let me know why this happening