using tsne, vp-trees, and cosine similarity to search and visualise a dataset through affection mapping
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
1.0 KiB

#include "Request.h"
Request::Request(){
}
void Request::setup(std::string ip, int port, std::string page){
request.method = ofHttpRequest::POST;
request.url = "http://" + ip + ":" + ofToString(port) + "/" + page;
request.headers["Content-Type"] = "application/json";
}
VPQuery Request::query(Vector7D input){
request.body = "{\"vector\": [" +
ofToString(input.angry) + "," +
ofToString(input.disgust) + "," +
ofToString(input.fear) + "," +
ofToString(input.happy) + "," +
ofToString(input.sad) + "," +
ofToString(input.surprise) + "," +
ofToString(input.neutral) + "]}";
auto response = http.handleRequest(request);
jsonResponse = ofJson::parse(response.data.getText());
VPQuery queryResponse;
queryResponse.folder = jsonResponse["folder"];
queryResponse.image = jsonResponse["image"];
queryResponse.video = jsonResponse["video"];
queryResponse.frame = ofToInt(jsonResponse["frame"]) + 10;
return queryResponse;
}