Skip to content

Questions for API integration #105

@JerixHub

Description

@JerixHub

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions