mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-06 10:25:17 +08:00
flag cwd fix
This commit is contained in:
parent
ecbe1c5488
commit
f62f256ce5
@ -107,18 +107,20 @@ def predict():
|
|||||||
|
|
||||||
@app.route("/api/flag/", methods=["POST"])
|
@app.route("/api/flag/", methods=["POST"])
|
||||||
def flag():
|
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[
|
output = {'inputs': [app.interface.input_interfaces[
|
||||||
i].rebuild(
|
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))],
|
in range(len(app.interface.input_interfaces))],
|
||||||
'outputs': [app.interface.output_interfaces[
|
'outputs': [app.interface.output_interfaces[
|
||||||
i].rebuild(
|
i].rebuild(
|
||||||
app.interface.flagging_dir, request.json['data']['output_data'][i])
|
flag_path, request.json['data']['output_data'][i])
|
||||||
for i
|
for i
|
||||||
in range(len(app.interface.output_interfaces))]}
|
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)
|
is_new = not os.path.exists(log_fp)
|
||||||
|
|
||||||
|
@ -107,18 +107,20 @@ def predict():
|
|||||||
|
|
||||||
@app.route("/api/flag/", methods=["POST"])
|
@app.route("/api/flag/", methods=["POST"])
|
||||||
def flag():
|
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[
|
output = {'inputs': [app.interface.input_interfaces[
|
||||||
i].rebuild(
|
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))],
|
in range(len(app.interface.input_interfaces))],
|
||||||
'outputs': [app.interface.output_interfaces[
|
'outputs': [app.interface.output_interfaces[
|
||||||
i].rebuild(
|
i].rebuild(
|
||||||
app.interface.flagging_dir, request.json['data']['output_data'][i])
|
flag_path, request.json['data']['output_data'][i])
|
||||||
for i
|
for i
|
||||||
in range(len(app.interface.output_interfaces))]}
|
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)
|
is_new = not os.path.exists(log_fp)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user