From f62f256ce5d514ab9984e4c84d3042c6db3e64b7 Mon Sep 17 00:00:00 2001 From: aliabd Date: Wed, 23 Sep 2020 17:30:41 +0400 Subject: [PATCH] flag cwd fix --- build/lib/gradio/networking.py | 10 ++++++---- gradio/networking.py | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/build/lib/gradio/networking.py b/build/lib/gradio/networking.py index 36bc3d3199..2bc55d0eaf 100644 --- a/build/lib/gradio/networking.py +++ b/build/lib/gradio/networking.py @@ -107,18 +107,20 @@ def predict(): @app.route("/api/flag/", methods=["POST"]) def flag(): - os.makedirs(app.interface.flagging_dir, exist_ok=True) + flag_path = os.path.join(app.cwd, app.interface.flagging_dir) + os.makedirs(flag_path, + exist_ok=True) output = {'inputs': [app.interface.input_interfaces[ i].rebuild( - app.interface.flagging_dir, request.json['data']['input_data'][i]) for i + flag_path, request.json['data']['input_data'][i]) for i in range(len(app.interface.input_interfaces))], 'outputs': [app.interface.output_interfaces[ i].rebuild( - app.interface.flagging_dir, request.json['data']['output_data'][i]) + flag_path, request.json['data']['output_data'][i]) for i in range(len(app.interface.output_interfaces))]} - log_fp = "{}/log.csv".format(app.interface.flagging_dir) + log_fp = "{}/log.csv".format(flag_path) is_new = not os.path.exists(log_fp) diff --git a/gradio/networking.py b/gradio/networking.py index 36bc3d3199..2bc55d0eaf 100644 --- a/gradio/networking.py +++ b/gradio/networking.py @@ -107,18 +107,20 @@ def predict(): @app.route("/api/flag/", methods=["POST"]) def flag(): - os.makedirs(app.interface.flagging_dir, exist_ok=True) + flag_path = os.path.join(app.cwd, app.interface.flagging_dir) + os.makedirs(flag_path, + exist_ok=True) output = {'inputs': [app.interface.input_interfaces[ i].rebuild( - app.interface.flagging_dir, request.json['data']['input_data'][i]) for i + flag_path, request.json['data']['input_data'][i]) for i in range(len(app.interface.input_interfaces))], 'outputs': [app.interface.output_interfaces[ i].rebuild( - app.interface.flagging_dir, request.json['data']['output_data'][i]) + flag_path, request.json['data']['output_data'][i]) for i in range(len(app.interface.output_interfaces))]} - log_fp = "{}/log.csv".format(app.interface.flagging_dir) + log_fp = "{}/log.csv".format(flag_path) is_new = not os.path.exists(log_fp)