Fix everything :D

main
Charlotte Som 2023-07-06 21:50:11 +00:00
parent 2546b1c559
commit 87ed7066d7
3 changed files with 23 additions and 16 deletions

View File

@ -159,7 +159,7 @@ def sse():
if message.get("task") != task_id:
continue
message = json.dumps(message)
yield f"{message}\n\n"
yield f"data:{message}\n\n"
return Response(
stream(),

View File

@ -12,18 +12,21 @@
<p>status: <strong class="status">{{ status }}</strong></p>
<p>originally: <strong>{{ orig_name }}</strong></p>
<section class="progress-section" {% if progress.get('stage') is None %}style="display: none" {% endif %}>
<section class="progress-section" {% if status !="in progress" or progress.get('stage') is none %}style="display: none"
{% endif %}>
<h3>progress</h3>
<p>
stage:
<data id="stage">{{ progress.get('stage') or '' }}</data> /
<data id="stages">{{ progress.get('stages') or '' }}</data>
</p>
<p>
step:
<data id="step">{{ progress.get('step') or '' }}</data> /
<data id="stage-steps">{{ progress.get('stage-steps') or '' }}</data>
</p>
<ul>
<li>
stage:
<data id="stage">{{ progress.get('stage') or '' }}</data> /
<data id="stages">{{ progress.get('stages') or '' }}</data>
</li>
<li>
step:
<data id="step">{{ progress.get('step') or '' }}</data> /
<data id="stage-steps">{{ progress.get('stage-steps') or '' }}</data>
</li>
</ul>
</section>
<script>
@ -37,15 +40,20 @@
}
if (message.progress != null) {
document.querySelector("progress-section").style.display = "unset";
document.querySelector(".progress-section").style.display = "unset";
for (const item in message.progress) {
document.getElementById(item).textContent = message.progress[item];
}
}
if (message.output != null) {
setTimeout(() => {
window.location.reload();
}, 250);
}
};
</script>
{% if outputs %}
<ul class="track-list">
{% for output in outputs %}
<li>
@ -56,6 +64,5 @@
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}

View File

@ -1,3 +1,3 @@
#!/usr/bin/env sh
gunicorn -b '127.0.0.2:8000' demucs_server:app
gunicorn --threads 16 -b '127.0.0.2:8000' demucs_server:app