Skip to content

Commit

Permalink
[edge-ai] Added method call to AI service
Browse files Browse the repository at this point in the history
  • Loading branch information
CesarCoelho committed May 27, 2022
1 parent 3d1f411 commit b5dce2e
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
import esa.mo.nmf.NMFException;
import esa.mo.nmf.NMFInterface;
import esa.mo.nmf.NMFProvider;
import java.io.IOException;
import org.ccsds.moims.mo.mal.MALException;
import org.ccsds.moims.mo.mal.MALInteractionException;
import org.ccsds.moims.mo.platform.artificialintelligence.consumer.ArtificialIntelligenceStub;

/**
* The adapter for the NMF App
Expand Down Expand Up @@ -77,7 +81,6 @@ public void initialRegistrations(MCRegistration registration) {
@Override
public UInteger actionArrived(Identifier name, AttributeValueList attributeValues,
Long actionInstanceObjId, boolean reportProgress, MALInteraction interaction) {

if (ACTION_START_AI.equals(name.getValue())) {
triggerAIInference(actionInstanceObjId, attributeValues);
return null; // Success!
Expand Down Expand Up @@ -141,6 +144,17 @@ private void triggerAIInference(Long actionInstanceObjId, AttributeValueList att
processMap.put(actionInstanceObjId, exec);
*/

try {
String modelPath = "";
String inputTilesPath = "";

ArtificialIntelligenceStub aiService = connector.getPlatformServices().getAIService();
Long id = aiService.setModel(modelPath);
aiService.doInference(id, inputTilesPath);
} catch (MALInteractionException | MALException | IOException | NMFException ex) {
LOG.log(Level.SEVERE, "AI was not performed...", ex);
}
}

private void destroyProcess(AttributeValueList attributeValues) {
Expand Down

0 comments on commit b5dce2e

Please sign in to comment.