Coder Social home page Coder Social logo

JSON RESULTS NOT COMPLETE about nudenet HOT 8 CLOSED

AlexUrrutia avatar AlexUrrutia commented on June 4, 2024
JSON RESULTS NOT COMPLETE

from nudenet.

Comments (8)

bedapudi6788 avatar bedapudi6788 commented on June 4, 2024 2

Hi, the docker image I pushed is pretty old and based on v2. also looks like you are running docker image for classification instead of detection.

I will push a new docker image and update it here.

from nudenet.

bedapudi6788 avatar bedapudi6788 commented on June 4, 2024 1

https://github.com/notAI-tech/NudeNet#docker @AlexUrrutia

from nudenet.

AlexUrrutia avatar AlexUrrutia commented on June 4, 2024 1

ok I fixed the code and now it works, thanks!

<?php

$url = "http://localhost:8080/infer";

$imageFilePath = 'path/to/image/image.jpg';

$imageFileHandle = fopen($imageFilePath, 'r');

if ($imageFileHandle === false) {
    die('Unable to open the image file.');
}

$ch = curl_init($url);

$postData = [
    'image' => curl_file_create($imageFilePath, 'image/jpeg', 'image.jpg'),
];

curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

$result = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'cURL Error: ' . curl_error($ch);
} else {
    echo $result;
}

curl_close($ch);
fclose($imageFileHandle);
?>

from nudenet.

AlexUrrutia avatar AlexUrrutia commented on June 4, 2024

https://github.com/notAI-tech/NudeNet#docker @AlexUrrutia

Thanks, I'll test it now

from nudenet.

AlexUrrutia avatar AlexUrrutia commented on June 4, 2024

Now I get this:

{
    "success": false,
    "reason": "Received json input. Expected multi-part file input."
}

from nudenet.

bedapudi6788 avatar bedapudi6788 commented on June 4, 2024

curl -F f1=@"images.jpeg" "http://localhost:8080/infer"
this is the curl.

from nudenet.

bedapudi6788 avatar bedapudi6788 commented on June 4, 2024

what curl are you sending ?

from nudenet.

AlexUrrutia avatar AlexUrrutia commented on June 4, 2024

Hello, I was using the php script posted here some time ago...

<?php

header("Content-Type: application/json");
$url = "http://localhost:8080/infer";
$image1 = base64_encode(file_get_contents('https://domain.com/16955673673220129769.jpg'));
	
$data = array('data' => array('image'=>$image1));
$payload = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result1 = curl_exec($ch);
print_r($result1);

?>

from nudenet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.