我在xxxx端口上运行rasa nlu培训师。我想从我的应用程序(流星)到rasa nlu培训师打电话给不同来源的nlu培训师。我想到了对nlu培训师的卷曲请求,但我们怎么能用curl命令进行rasa nlu training的源标志?
或者我是否有另一种选择来为我的流星应用程序提供动态源路径的rasa nlu培训师? 请指导我。
答案 0 :(得分:0)
As mentioned in their official documentation,你可以制作cURL 使用 / train 端点向RASA NLU请求。它是一个HTTP POST 请求,所以请确保将语料库作为请求体发送。
$ curl -XPOST localhost:5000/train?project=my_project -d @data/examples/rasa/demo-rasa.json
或者,你可以这样做:
创建一个批处理文件,用于训练RASA,如TrainRASA.bat,它将具有以下python命令:
cd <Your Path>
python -m rasa_nlu.train -c config_spacy.json
按如下方式生成config_spacy.json文件:
{
"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
}
现在制作一个C#Web API来训练您的RASA模型,如下所示:
[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;
}
}
现在只需从Chrome发送一个HTTP GET,将批处理文件目录作为参数传递。