Questions for API integration
JerixHub opened this issue · comments
I've been trying to use send API request to this https://ainize.ai/psi1104/White-box-Cartoonization?branch=master
and I am not able to achieve my goal. I don't know what kind of post request I need to do to get a response.
I've been using laravel to integrate this
here's my code pls help
$url = 'https://storage.googleapis.com/avazoo-storage/avatar/mA7SnzjpwfDcWYPNqzThRDq2JqH5DiKsQn9pu0Hj.jpg';
$info = pathinfo($url);
$contents = file_get_contents($url);
$encoded_image = base64_encode($contents);
$stored = Storage::disk('local')->put($info['basename'], $contents);
$storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix();
$fullPath = $storagePath.'/'.$info['basename'];
$uploaded_file = new File($fullPath, $info['basename']);
$cartoonize_url = 'https://master-white-box-cartoonization-psi1104.endpoint.ainize.ai/predict';
$payment_response = Http::withHeaders([
'Content-Type' => 'multipart/form-data'
])->post($cartoonize_url, [
'file_type' => 'image',
'source' => $uploaded_file
]);
dd($payment_response);
This code always returns a bad request