Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions for API integration #105

Open
JerixHub opened this issue Apr 6, 2022 · 0 comments
Open

Questions for API integration #105

JerixHub opened this issue Apr 6, 2022 · 0 comments

Comments

@JerixHub
Copy link

JerixHub commented Apr 6, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant