Options

how to input nested JSON through API generated from AI Hub?

HarshMahajanHarshMahajan Member Posts: 2 Newbie
I have 5 JSON for one prediction problem which is generated from various sources.
I have a python script which convert JSON into features and prediction can be made on that data.
Now the whole process is running in RM studio but during deployment from API generate through AI hub. 
The JSON input is not working. 

Please help me out here.

Answers

  • Options
    vivek101vivek101 Member Posts: 8 Contributor II
    Hi @HarshMahajan,

    These steps may be used to input nested JSON using an API created by AI Hub:

    1. Make sure the API endpoint is configured properly: Make that the AI Hub-generated API is deployed and that the endpoint URL is prepared for receiving queries.

    2. You reported having 5 JSON files for a prediction issue. Prepare the nested JSON data. Combine these JSON files to create a layered JSON structure that contains all of the data needed to feed your prediction model. Make that the layered JSON structure adheres to the API endpoint's anticipated format.

    3. An HTTP request should be sent to the API endpoint: You must use the combined nested JSON data as the 'request' payload in your Python script to send an HTTP request to the API endpoint. Python's requests package may be used to do this.

    4. Set the right headers and HTTP method: When submitting the request, make sure to set the correct headers, such as 'Content-Type' to indicate that you are providing JSON data. Set the proper HTTP method (like POST) to use when sending the data to the API.

    5. Send the inquiry, then manage the response: Send the API endpoint the HTTP request along with the nested JSON data. After processing the request and making the prediction using your model, the API will respond. Your Python script can appropriately capture and process the answer.

    6. Verify and debug: Check that the nested JSON structure adheres to the anticipated input format specified by your model if you are having problems with the JSON input not working. Check the field names and the JSON data's structure. Check the AI Hub API to see if there are any additional prerequisites or limitations.

    It's important to note that based on the particular API and framework you are using, the precise implementation details might change. To verify you are using the right procedure for your configuration, check the documentation offered by AI Hub and any pertinent libraries.

    Best Wishes
    Vivek Garg
    Golang Training
Sign In or Register to comment.