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: if message.get("task") != task_id:
continue continue
message = json.dumps(message) message = json.dumps(message)
yield f"{message}\n\n" yield f"data:{message}\n\n"
return Response( return Response(
stream(), stream(),

View File

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

View File

@ -1,3 +1,3 @@
#!/usr/bin/env sh #!/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