Package: nextbrain
NextBrain AIConvenient access to theNextBrain AIAPI from pythonInstallationpipinstallnextbrainIf you want to use the async version you need to installasyncioandaiohttp:pipinstallasyncioaiohttpNormal usageAll steps in one.fromnextbrainimportNextBrainfromtypingimportAny,Listdefmain():nb=NextBrain('<YOUR-ACCESS-TOKEN-HERE>')# You can create your custom table and predict table by your own from any source# It is a list of list, where the first row contains the header# Example:# [#   [ Column1, Column2, Column3 ],#   [       1,       2,       3 ],#   [       4,       5,       6 ]# ]table:List[List[Any]]=nb.load_csv('<PATH-TO-YOUR-TRAINING-CSV>')predict_table:List[List[Any]]=nb.load_csv('<PATH-TO-YOUR-PREDICTING-CSV>')model_id,response=nb.upload_and_predict(table,predict_table,'<YOUR-TARGET-COLUMN>')# model_id is also returned in order to predict multiple times against same modelprint(response)if__name__=='__main__':main()Step by stepfromnextbrainimportNextBrainfromtypingimportAny,Listdefmain():nb=NextBrain('<YOUR-ACCESS-TOKEN-HERE>')# You can create your custom table and predict table by your own from any sourcetable:List[List[Any]]=nb.load_csv('<PATH-TO-YOUR-TRAINING-CSV>')# Upload the model to NextBrain servicemodel_id:str=nb.upload_model(table)# Train the model# You can re-train a previous modelnb.train_model(model_id,'<YOUR-TARGET-COLUMN>')predict_table:List[List[Any]]=nb.load_csv('<PATH-TO-YOUR-PREDICTING-CSV>')# You can predict multiple using the same model (don't need to create a new model each time)response=nb.predict_model(model_id,predict_table)print(response)if__name__=='__main__':main()Async usageAll steps in one.fromnextbrainimportAsyncNextBrainfromtypingimportAny,Listasyncdefmain():nb=AsyncNextBrain('<YOUR-ACCESS-TOKEN-HERE>')# You can create your custom table and predict table by your own from any sourcetable:List[List[Any]]=nb.load_csv('<PATH-TO-YOUR-TRAINING-CSV>')predict_table:List[List[Any]]=nb.load_csv('<PATH-TO-YOUR-PREDICTING-CSV>')model_id,response=awaitnb.upload_and_predict(table,predict_table,'<YOUR-TARGET-COLUMN>')# model_id is also returned in order to predict multiple times against same modelprint(response)if__name__=='__main__':importasyncioasyncio.run(main())Step by stepfromnextbrainimportAsyncNextBrainfromtypingimportAny,Listasyncdefmain():nb=AsyncNextBrain('<YOUR-ACCESS-TOKEN-HERE>')# You can create your custom table and predict table by your own from any sourcetable:List[List[Any]]=nb.load_csv('<PATH-TO-YOUR-TRAINING-CSV>')# Upload the model to NextBrain servicemodel_id:str=awaitnb.upload_model(table)# Train the model# You can re-train a previous modelawaitnb.train_model(model_id,'<YOUR-TARGET-COLUMN>')predict_table:List[List[Any]]=nb.load_csv('<PATH-TO-YOUR-PREDICTING-CSV>')# You can predict multiple using the same model (don't need to create a new model each time)response=awaitnb.predict_model(model_id,predict_table)print(response)if__name__=='__main__':importasyncioasyncio.run(main())Extra notesEverytime you train, you can select an option to create lightning models.is_lightningis an optional parameter that by default is set toFalsebut can be overrided intrain_modelandupload_and_predict.We also recommend that you investigate all the methods that the class provides you with to make the most of the functionalities we offer. For example, you can use theget_accuracymethod to obtain all the information about the performance of your model.