rasa/core/training/interactive.py
def start_visualization(image_path: Text = None) -> None:
    """Add routes to serve the conversation visualization files."""

    app = Sanic(__name__)

    # noinspection PyUnusedLocal
    @app.exception(NotFound)
    async def ignore_404s(request, exception):
        return response.text("Not found", status=404)

    # noinspection PyUnusedLocal
    @app.route(VISUALIZATION_TEMPLATE_PATH, methods=["GET"])
    def visualisation_html(request):
        return response.file(visualization.visualization_html_path())

    # noinspection PyUnusedLocal
    @app.route("/visualization.dot", methods=["GET"])
    def visualisation_png(request):
        try:
            headers = {'Cache-Control': "no-cache"}
            return response.file(os.path.abspath(image_path), headers=headers)
        except FileNotFoundError:
            return response.text("", 404)

    app.run(host='0.0.0.0', port=DEFAULT_SERVER_PORT + 1, access_log=False)
Add routes to serve the conversation visualization files.
Add routes to serve the conversation visualization files.
Add routes to serve the conversation visualization files .
def start_visualization(image_path: Text = None) -> None:
    app = Sanic(__name__)
    @app.exception(NotFound)
    async def ignore_404s(request, exception):
        return response.text("Not found", status=404)
    @app.route(VISUALIZATION_TEMPLATE_PATH, methods=["GET"])
    def visualisation_html(request):
        return response.file(visualization.visualization_html_path())
    @app.route("/visualization.dot", methods=["GET"])
    def visualisation_png(request):
        try:
            headers = {'Cache-Control': "no-cache"}
            return response.file(os.path.abspath(image_path), headers=headers)
        except FileNotFoundError:
            return response.text("", 404)
    app.run(host='0.0.0.0', port=DEFAULT_SERVER_PORT + 1, access_log=False)
def start_visualization ( image_path : Text = None ) -> None : app = Sanic ( __name__ ) @ app . exception ( NotFound ) async def ignore_404s ( request , exception ) : return response . text ( "Not found" , status = 404 ) @ app . route ( VISUALIZATION_TEMPLATE_PATH , methods = [ "GET" ] ) def visualisation_html ( request ) : return response . file ( visualization . visualization_html_path ( ) ) @ app . route ( "/visualization.dot" , methods = [ "GET" ] ) def visualisation_png ( request ) : try : headers = { 'Cache-Control' : "no-cache" } return response . file ( os . path . abspath ( image_path ) , headers = headers ) except FileNotFoundError : return response . text ( "" , 404 ) app . run ( host = '0.0.0.0' , port = DEFAULT_SERVER_PORT + 1 , access_log = False )
Add routes to serve the conversation visualization files.
Add routes to serve the conversation visualization files .
"""Add routes to serve the conversation visualization files.""" # noinspection PyUnusedLocal # noinspection PyUnusedLocal # noinspection PyUnusedLocal
image_path
Text