【发布时间】:2021-06-10 16:16:03
【问题描述】:
我有一个经过训练的语音合成模型。它每次从 html 页面中的 textarea 正确创建音频并将其保存为静态文件夹。但有时当我从文件夹返回音频时,它会带来较旧的音频。它不会每次都发生,但我找不到解决方案。
html音频代码
{% if my_audio %}
<audio controls>
<source src="{{ url_for('static', filename='a.wav') }}" type="audio/wav"/>
</audio>
{% endif %}
烧瓶代码(如果需要)
from flask import Flask, render_template, request
import inference
app = Flask(__name__)
app.static_folder = 'static'
@app.route("/")
def home():
return render_template("index.html")
@app.route("/sentez", methods = ["POST"])
def sentez():
if request.method == "POST":
metin = request.form["metin"]
created_audio = inference.create_model(metin)
return render_template("index.html", my_audio = created_audio)
if __name__ == "__main__":
app.run();
【问题讨论】:
标签: python html flask audio static