Spaces:
Running
Running
refactor: Remove chunk timestamp display
Browse filesRemoves the feature that displays the timestamps of the audio chunks. This simplifies the UI and the backend code.
- main.py +0 -2
- static/main.js +0 -13
- templates/index.html +1 -18
main.py
CHANGED
|
@@ -300,8 +300,6 @@ async def _transcribe_and_stream(api_key: str, file_content: bytes, model_name:
|
|
| 300 |
yield send_event("progress", f"אורך פס הקול {len(audio) / 60000:.1f} דקות. מבצע חלוקה...", 15)
|
| 301 |
chunks = await asyncio.to_thread(split_audio_webrtcvad, audio, MIN_SILENCE_LEN_MS)
|
| 302 |
if not chunks: raise ValueError("לא נוצרו מקטעי שמע לעיבוד.")
|
| 303 |
-
chunk_info_messages = [f"{i+1}. {format_ms_to_srt_time(sum(len(c) for c in chunks[:i]))} - {format_ms_to_srt_time(sum(len(c) for c in chunks[:i+1]))}" for i in range(len(chunks))]
|
| 304 |
-
yield send_event("chunk_timestamps", message="השמע חולק למקטעים בנקודות הבאות:", data="\n".join(chunk_info_messages))
|
| 305 |
|
| 306 |
yield send_event("progress", f"הקובץ חולק ל-{len(chunks)} מקטעים. מתחיל תמלול...", 20)
|
| 307 |
|
|
|
|
| 300 |
yield send_event("progress", f"אורך פס הקול {len(audio) / 60000:.1f} דקות. מבצע חלוקה...", 15)
|
| 301 |
chunks = await asyncio.to_thread(split_audio_webrtcvad, audio, MIN_SILENCE_LEN_MS)
|
| 302 |
if not chunks: raise ValueError("לא נוצרו מקטעי שמע לעיבוד.")
|
|
|
|
|
|
|
| 303 |
|
| 304 |
yield send_event("progress", f"הקובץ חולק ל-{len(chunks)} מקטעים. מתחיל תמלול...", 20)
|
| 305 |
|
static/main.js
CHANGED
|
@@ -15,9 +15,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 15 |
const downloadSrtButton = document.getElementById('download-srt-button');
|
| 16 |
const downloadTxtButton = document.getElementById('download-txt-button');
|
| 17 |
const copyButton = document.getElementById('copy-button');
|
| 18 |
-
const chunkInfoSection = document.getElementById('chunk-info-section');
|
| 19 |
-
const chunkInfoMessage = document.getElementById('chunk-info-message');
|
| 20 |
-
const chunkTimestampsOutput = document.getElementById('chunk-timestamps-output');
|
| 21 |
const resultsOutput = document.getElementById('results-output');
|
| 22 |
const resultsViewToggle = document.getElementById('results-view-toggle');
|
| 23 |
const viewSrtBtn = document.getElementById('view-srt-btn');
|
|
@@ -84,9 +81,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 84 |
statusContainer.style.display = 'none';
|
| 85 |
resultsSection.style.display = 'none';
|
| 86 |
resultsViewToggle.style.display = 'none';
|
| 87 |
-
chunkInfoSection.style.display = 'none';
|
| 88 |
-
chunkTimestampsOutput.textContent = '';
|
| 89 |
-
chunkInfoMessage.textContent = '';
|
| 90 |
updateStatus("", 0);
|
| 91 |
}
|
| 92 |
|
|
@@ -283,9 +277,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 283 |
if (submitButton.disabled) return;
|
| 284 |
|
| 285 |
resultsSection.style.display = 'none';
|
| 286 |
-
chunkInfoSection.style.display = 'none';
|
| 287 |
-
chunkTimestampsOutput.textContent = '';
|
| 288 |
-
chunkInfoMessage.textContent = '';
|
| 289 |
|
| 290 |
setFormEnabled(false);
|
| 291 |
updateStatus('מתחיל את התהליך...', 0);
|
|
@@ -321,10 +312,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
| 321 |
const event = JSON.parse(eventStr);
|
| 322 |
if (event.type === 'progress') {
|
| 323 |
updateStatus(event.message, event.percent);
|
| 324 |
-
} else if (event.type === 'chunk_timestamps') {
|
| 325 |
-
chunkInfoSection.style.display = 'block';
|
| 326 |
-
chunkInfoMessage.textContent = event.message;
|
| 327 |
-
chunkTimestampsOutput.textContent = event.data;
|
| 328 |
} else if (event.type === 'result') {
|
| 329 |
updateStatus(event.message, event.percent);
|
| 330 |
resultsSection.style.display = 'block';
|
|
|
|
| 15 |
const downloadSrtButton = document.getElementById('download-srt-button');
|
| 16 |
const downloadTxtButton = document.getElementById('download-txt-button');
|
| 17 |
const copyButton = document.getElementById('copy-button');
|
|
|
|
|
|
|
|
|
|
| 18 |
const resultsOutput = document.getElementById('results-output');
|
| 19 |
const resultsViewToggle = document.getElementById('results-view-toggle');
|
| 20 |
const viewSrtBtn = document.getElementById('view-srt-btn');
|
|
|
|
| 81 |
statusContainer.style.display = 'none';
|
| 82 |
resultsSection.style.display = 'none';
|
| 83 |
resultsViewToggle.style.display = 'none';
|
|
|
|
|
|
|
|
|
|
| 84 |
updateStatus("", 0);
|
| 85 |
}
|
| 86 |
|
|
|
|
| 277 |
if (submitButton.disabled) return;
|
| 278 |
|
| 279 |
resultsSection.style.display = 'none';
|
|
|
|
|
|
|
|
|
|
| 280 |
|
| 281 |
setFormEnabled(false);
|
| 282 |
updateStatus('מתחיל את התהליך...', 0);
|
|
|
|
| 312 |
const event = JSON.parse(eventStr);
|
| 313 |
if (event.type === 'progress') {
|
| 314 |
updateStatus(event.message, event.percent);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
} else if (event.type === 'result') {
|
| 316 |
updateStatus(event.message, event.percent);
|
| 317 |
resultsSection.style.display = 'block';
|
templates/index.html
CHANGED
|
@@ -85,24 +85,7 @@
|
|
| 85 |
</div>
|
| 86 |
</div>
|
| 87 |
|
| 88 |
-
<
|
| 89 |
-
<h2>חלוקת קובץ השמע למקטעים</h2>
|
| 90 |
-
<p id="chunk-info-message" style="margin-bottom: 1rem;"></p>
|
| 91 |
-
<pre id="chunk-timestamps-output" style="
|
| 92 |
-
background-color: var(--md-sys-color-surface);
|
| 93 |
-
padding: 1rem;
|
| 94 |
-
border-radius: var(--border-radius-small);
|
| 95 |
-
border: 1px solid var(--md-sys-color-outline);
|
| 96 |
-
font-family: monospace;
|
| 97 |
-
font-size: 0.9rem;
|
| 98 |
-
direction: rtl;
|
| 99 |
-
text-align: right;
|
| 100 |
-
max-height: 200px;
|
| 101 |
-
overflow-y: auto;
|
| 102 |
-
"></pre>
|
| 103 |
-
</div>
|
| 104 |
-
|
| 105 |
-
<section id="results-section" class="card">
|
| 106 |
<div class="results-header">
|
| 107 |
<h2>תוצאות התמלול</h2>
|
| 108 |
<div class="view-toggle" id="results-view-toggle">
|
|
|
|
| 85 |
</div>
|
| 86 |
</div>
|
| 87 |
|
| 88 |
+
<section id="results-section" class="card" style="margin-top: 2rem;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
<div class="results-header">
|
| 90 |
<h2>תוצאות התמלול</h2>
|
| 91 |
<div class="view-toggle" id="results-view-toggle">
|