Spaces:
Running
Running
pin to the bottom of transcript so user can always follow the latest part of it
Browse files- app/static/index.html +23 -4
app/static/index.html
CHANGED
@@ -54,6 +54,21 @@
|
|
54 |
padding: 1rem 1.5rem;
|
55 |
border-radius: 10px;
|
56 |
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
.label {
|
@@ -115,8 +130,8 @@
|
|
115 |
|
116 |
<label for="precisionSelect">Precision:</label>
|
117 |
<select id="precisionSelect">
|
118 |
-
<option value="int8">INT8</option>
|
119 |
<option value="fp32">FP32</option>
|
|
|
120 |
</select>
|
121 |
</div>
|
122 |
|
@@ -127,7 +142,8 @@
|
|
127 |
<progress id="vol" max="1" value="0"></progress>
|
128 |
|
129 |
<div class="output">
|
130 |
-
<div><span class="label">Transcript:</span
|
|
|
131 |
</div>
|
132 |
|
133 |
<script>
|
@@ -185,7 +201,7 @@
|
|
185 |
updateModelInfo();
|
186 |
|
187 |
// Now that we know the sample rate, open the WS
|
188 |
-
ws = new WebSocket(`
|
189 |
ws.onopen = () => sendConfig();
|
190 |
ws.onerror = err => console.error("WebSocket error:", err);
|
191 |
ws.onclose = () => console.log("WebSocket closed");
|
@@ -195,7 +211,10 @@
|
|
195 |
vol.value = Math.min(msg.volume * 20.0, 1.0);
|
196 |
}
|
197 |
if (msg.partial) {
|
198 |
-
|
|
|
|
|
|
|
199 |
}
|
200 |
};
|
201 |
|
|
|
54 |
padding: 1rem 1.5rem;
|
55 |
border-radius: 10px;
|
56 |
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
57 |
+
display: flex;
|
58 |
+
flex-direction: column;
|
59 |
+
}
|
60 |
+
.transcript-container {
|
61 |
+
flex: 1; /* take remaining vertical space */
|
62 |
+
max-height: 300px; /* adjust as you like */
|
63 |
+
margin-top: 0.5rem;
|
64 |
+
padding: 0.5rem;
|
65 |
+
background: #fff;
|
66 |
+
border: 1px solid #dcdde1;
|
67 |
+
border-radius: 8px;
|
68 |
+
overflow-y: auto; /* make it scrollable */
|
69 |
+
white-space: pre-wrap; /* preserve line breaks */
|
70 |
+
font-size: 1.1rem;
|
71 |
+
color: #353b48;
|
72 |
}
|
73 |
|
74 |
.label {
|
|
|
130 |
|
131 |
<label for="precisionSelect">Precision:</label>
|
132 |
<select id="precisionSelect">
|
|
|
133 |
<option value="fp32">FP32</option>
|
134 |
+
<option value="int8">INT8</option>
|
135 |
</select>
|
136 |
</div>
|
137 |
|
|
|
142 |
<progress id="vol" max="1" value="0"></progress>
|
143 |
|
144 |
<div class="output">
|
145 |
+
<div><span class="label">Transcript:</span></div>
|
146 |
+
<div id="transcript" class="transcript-container">...</div>
|
147 |
</div>
|
148 |
|
149 |
<script>
|
|
|
201 |
updateModelInfo();
|
202 |
|
203 |
// Now that we know the sample rate, open the WS
|
204 |
+
ws = new WebSocket(`ws://${location.host}/ws`);
|
205 |
ws.onopen = () => sendConfig();
|
206 |
ws.onerror = err => console.error("WebSocket error:", err);
|
207 |
ws.onclose = () => console.log("WebSocket closed");
|
|
|
211 |
vol.value = Math.min(msg.volume * 20.0, 1.0);
|
212 |
}
|
213 |
if (msg.partial) {
|
214 |
+
// replace content…
|
215 |
+
transcript.textContent = msg.partial;
|
216 |
+
// …then scroll to bottom
|
217 |
+
transcript.scrollTop = transcript.scrollHeight;
|
218 |
}
|
219 |
};
|
220 |
|