如何对 rasa nlu trainer 进行 CURL 调用
How to make a CURL call to rasa nlu trainer
我在 xxxx 上有 rasa nlu trainer 运行 port.I 每当从我的应用程序(流星)调用 rasa nlu trainer.I 时,我想用不同的来源喂养 nlu trainer对 nlu 训练器的 curl 请求,但我们如何使用 curl 命令输入 rasa nlu 训练器的 --source 标志?
或者我是否有另一种选择来为 rasa nlu 训练器提供来自我的流星应用程序的动态源路径?
请指导我。
As mentioned in their official documentation, you can make cURL
Requests to RASA NLU using the /train endpoint. Its a HTTP POST
request, so make sure sending the corpus as request body.
$ 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。
我在 xxxx 上有 rasa nlu trainer 运行 port.I 每当从我的应用程序(流星)调用 rasa nlu trainer.I 时,我想用不同的来源喂养 nlu trainer对 nlu 训练器的 curl 请求,但我们如何使用 curl 命令输入 rasa nlu 训练器的 --source 标志?
或者我是否有另一种选择来为 rasa nlu 训练器提供来自我的流星应用程序的动态源路径? 请指导我。
As mentioned in their official documentation, you can make cURL Requests to RASA NLU using the /train endpoint. Its a HTTP POST request, so make sure sending the corpus as request body.
$ 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。