本文介绍了如何拨打电话给rasa nlu培训师的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在xxxx端口上运行了rasa nlu训练器.我想在我的应用程序(流星)对rasa nlu训练器进行调用时,使用其他源来提供nlu训练器.用curl命令将rasa nlu训练器的--source标记喂入?

I had rasa nlu trainer running on xxxx port.I want to feed nlu trainer with a different source whenever a call made from my app(meteor) to rasa nlu trainer.I thought of curl request to nlu trainer but how can we fed --source flag of rasa nlu trainer with curl command?

或者我还有其他选择可以通过我的流星应用程序为rasa nlu培训师提供动态源路径吗?请指导我.

or Do I have an another option to feed rasa nlu trainer with a dynamic source path from my meteor application?PLease direct me.

推荐答案

$ curl -XPOST localhost:5000/train?project=my_project -d @data/examples/rasa/demo-rasa.json

或者,您可以执行以下操作:

制作一个具有用于训练RASA的批处理文件,例如TrainRASA.bat,它将具有以下python命令:

Make a batch file having for training RASA like TrainRASA.bat which will have the following python command:

cd <Your Path>
python -m rasa_nlu.train -c config_spacy.json

使config_spacy.json文件如下:

Make the config_spacy.json file as follows:

{
    "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模型,如下所示:

Now make a C# Web API to train your RASA Model like follows:

[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即可将批处理文件目录作为参数传递.

Now just make a HTTP GET from Chrome passing the batch file directory as arguments.

这篇关于如何拨打电话给rasa nlu培训师的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 18:43