How to direct output of interactive training to Console

Here is my code

asa-core 0.14.3 rasa-core-sdk 0.14.0 rasa-nlu 0.15.0

python3.7

When I execute the following code,

from future import absolute_import from future import division from future import print_function from future import unicode_literals

import logging import rasa_core

from rasa_core.run import serve_application from rasa_core import config from rasa_core.agent import Agent #from rasa_core.channels.console import ConsoleInputChannel from rasa_core.interpreter import RegexInterpreter from rasa_core.policies.keras_policy import KerasPolicy from rasa_core.policies.memoization import MemoizationPolicy from rasa_core.interpreter import RasaNLUInterpreter

logger = logging.getLogger( name )

def run_weather_online(input_channel, interpreter, domain_file=“weather_domain.yml”, training_data_file=‘data/stories.md’): agent = Agent(‘weather_domain.yml’, policies = [MemoizationPolicy(max_history=2), KerasPolicy(max_history=4)]) data = agent.load_data(training_data_file) agent.train(data) rasa_core.run.serve_application(agent ,channel=‘cmdline’) #interactive.run_interactive_learning(agent, training_data_file) return agent

if name == ’ main ‘: logging.basicConfig(level=“INFO”) nlu_interpreter = RasaNLUInterpreter(’./models/nlu/default/weatherbot’) #run_weather_online(ConsoleInputChannel(), nlu_interpreter) run_weather_online(‘cmdline’, nlu_interpreter)

Output NFO:rasa_core.policies.keras_policy:Done fitting keras policy model INFO:root:Rasa Core server is up and running on http://localhost:5005 Bot loaded. Type a message and press enter (use ‘/stop’ to exit): Your input -> Hello Hello! How can I help? 127.0.0.1 - - [2019-05-14 00:09:00] “POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1” 200 222 0.212841 Your input -> how is weather in Italy 127.0.0.1 - - [2019-05-14 00:09:10] “POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1” 200 154 0.009423 Your input -> 127.0.0.1 - - [2019-05-14 00:09:23] “GET / HTTP/1.1” 200 144 0.000800 127.0.0.1 - - [2019-05-14 00:09:32] “GET / HTTP/1.1” 200 144 0.000892 Your input -> ok 127.0.0.1 - - [2019-05-14 00:10:07] “POST /webhooks/rest/webhook?stream=true&token= HTTP/1.1” 200 154 0.011861 Your input ->

Why not running the interactive learning on the console itself?

Try: python3.6 -m rasa_core.train interactive -o models/current/dialogue -d domain.yml -s data/core/stories.md --nlu models/current/nlu --endpoints endpoints.yml

Replace the models/stories/nlu/endpoints with the correct files and directories.

Regards,

1 Like

Thanks it works !!

1 Like