J'ai eu rasa nlu trainer fonctionnant sur le port xxxx.Je veux nourrir nlu trainer avec une source différente chaque fois qu'un appel fait à partir de mon application (météore) à rasa nlu trainer.J'ai pensé de demande de curl à nlu trainer mais comment pouvons-nous fed --source drapeau de rasa nlu trainer avec curl commande? Ou ai-je une autre option pour alimenter rasa nlu trainer avec un chemin source dynamique à partir de mon application météore? Veuillez me diriger.Comment faire un appel CURL à rasa nlu trainer
0
A
Répondre
0
As mentioned in their official documentation, vous pouvez faire cURL Les demandes de RASA NLU en utilisant le point de terminaison /train. C'est une requête HTTP POST , alors assurez-vous d'envoyer le corpus en tant que corps de la demande.
$ curl -XPOST localhost:5000/train?project=my_project -d @data/examples/rasa/demo-rasa.json
Vous pouvez faire:
Faire un fichier de commandes ayant pour la formation RASA comme TrainRASA.bat qui aura la commande python suivant:
cd <Your Path>
python -m rasa_nlu.train -c config_spacy.json
Faire la fichier config_spacy.json comme suit:
{
"project": "Travel",
"pipeline": "spacy_sklearn",
"language": "en",
"num_threads": 1,
"max_training_processes": 1,
"path": "C:\\Users\\Kunal\\Desktop\\RASA\\models",
"response_log": "C:\\Users\\Kunal\\Desktop\\RASA\\log",
"config": "C:\\Users\\Kunal\\Desktop\\RASA\\config_spacy.json",
"log_level": "INFO",
"port": 5000,
"data": "C:\\Users\\Kunal\\Desktop\\RASA\\data\\FlightBotFinal.json",
"emulate": "luis",
"spacy_model_name": "en",
"token": null,
"cors_origins": ["*"],
"aws_endpoint_url": null
}
Maintenant, faites une API C# Web pour former votre modèle rasa comme suit:
[HttpGet]
[Route("api/TrainRASA")]
[EnableCors("*", "*", "*")]
public Task TrainRASA([FromUri] string BatchFilePath, [FromUri] string BatchFileDirectory)
{
try
{
return Task.Run(() =>
{
ProcessStartInfo startInfo = new ProcessStartInfo()
{
FileName = BatchFilePath,
CreateNoWindow = false,
UseShellExecute = true,
WindowStyle = ProcessWindowStyle.Normal,
WorkingDirectory = BatchFileDirectory
};
// Start the process with the info we specified.
// Call WaitForExit and then the using-statement will close.
using (System.Diagnostics.Process exeProcess = System.Diagnostics.Process.Start(startInfo))
{
exeProcess.WaitForExit();
}
});
}
catch (Exception ex)
{
throw;
}
}
Maintenant, il suffit de faire un HTTP GET de Chrome passer le répertoire des fichiers batch comme arguments.