Skip to content

Commit

Permalink
Fix results fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
BenAAndrew committed Dec 9, 2021
1 parent 2fc39af commit 61a654d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions application/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,12 @@ def synthesis_setup_post():

@app.route("/data/<path:path>")
def get_file(path):
subfolder = path.split("/")[0]
subpath = path.split("/")[1:-1]
filename = path.split("/")[-1]
mimetype = "image/png" if filename.endswith("png") else "audio/wav"
return serve_file(os.path.join("data", path.replace("/", os.sep)), filename, mimetype)
filepath = os.path.join(paths[subfolder], *subpath, filename)
return serve_file(filepath, filename, mimetype)


@app.route("/synthesis", methods=["GET", "POST"])
Expand All @@ -333,8 +336,8 @@ def synthesis_post():
os.makedirs(results_folder)
graph_path = os.path.join(results_folder, GRAPH_FILE)
audio_path = os.path.join(results_folder, RESULTS_FILE)
graph_web_path = graph_path.replace("\\", "/")
audio_web_path = audio_path.replace("\\", "/")
graph_web_path = os.path.relpath(graph_path).replace("\\", "/")
audio_web_path = os.path.relpath(audio_path).replace("\\", "/")
silence = float(request.form["silence"])
max_decoder_steps = int(request.form["max_decoder_steps"])

Expand Down
2 changes: 1 addition & 1 deletion training/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def train(
_, _, _, alignment = load_model(checkpoint_path).inference(alignment_sequence)
graph_path = os.path.join(alignment_folder, "checkpoint_{}.png".format(iteration))
generate_graph(alignment, graph_path, heading=f"Iteration {iteration}")
graph = graph_path.replace("\\", "/")
graph = os.path.relpath(graph_path).replace("\\", "/")
logging.info(f"Alignment - {iteration}, {graph}")
except Exception:
logging.info(
Expand Down

0 comments on commit 61a654d

Please sign in to comment.