Array as output data
Opened this issue · 5 comments
Hi there,
I'm trying to get out the output data of the Runway Model "Keras-OCR" running locally. It seems link with Runway is set up correctly as I see the output at http://localhost:8000/data.
However I can't seem to reach it in Openframeworks.
offApp.h:
ofxRunway runway;
string runwayResult;
ofApp.cpp:
runway.get("bboxes", runwayResult);
Input and output specification Runway model:
runway.getOutputTypes()
gives:
[
{
"description": null,
"itemType": {
"description": null,
"name": "image_bounding_box_array_item",
"type": "image_bounding_box"
},
"minLength": 0,
"name": "bboxes",
"type": "array"
},
{
"description": null,
"itemType": {
"default": "",
"description": null,
"minLength": 0,
"name": "text_array_item",
"type": "text"
},
"minLength": 0,
"name": "labels",
"type": "array"
}
]
How do I get out the array with ofxRunway?
Hi, that's not how it works. ofxRunway will parse those strings into the data type that those represent.
I just added some examples on how to use Keras-OCR.
Let me know if this is ok or if you still need to access the raw data.
Hi Roy, I would indeed like to get the raw data! To check those strings/text on certain words.
Hi @warddeboeck
That is already accessible.
so instead of running runway.get(...);
you need to run the following
ofxRunwayData dataToReceive;
while (runway.tryReceive(dataToReceive)) {
// dataToReceive.data contains the raw JSON data sent by runway. And it is here where you should perform what ever you need with it.
break;
}
Aha thanks, I see!
sure, no problem. I will close this issue and add a note about this in the readme.
Just if you are curious, take a look at ofxRunway.cpp and ofxRunwayData.cpp and you'll notice how most get functions are wrapping the chunck of code I just posted.
cheers