Spaces:
Running
Running
Fix Spaces UI API endpoint default to same-origin
Browse files- static/index.html +10 -2
static/index.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
|
@@ -400,7 +400,7 @@
|
|
| 400 |
<div class="controls">
|
| 401 |
<div class="field">
|
| 402 |
<label>API ENDPOINT</label>
|
| 403 |
-
<input type="text" id="apiUrl" value="
|
| 404 |
</div>
|
| 405 |
<div class="field">
|
| 406 |
<label>SPEAKERS (blank = auto)</label>
|
|
@@ -462,6 +462,12 @@ const SPEAKER_COLORS = [
|
|
| 462 |
|
| 463 |
let selectedFile = null;
|
| 464 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
// ββ File Handling ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 466 |
document.getElementById('audioFile').addEventListener('change', (e) => {
|
| 467 |
const file = e.target.files[0];
|
|
@@ -621,3 +627,5 @@ function fmtTime(sec) {
|
|
| 621 |
</script>
|
| 622 |
</body>
|
| 623 |
</html>
|
|
|
|
|
|
|
|
|
| 1 |
+
ο»Ώ<!DOCTYPE html>
|
| 2 |
<html lang="en">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
|
|
|
| 400 |
<div class="controls">
|
| 401 |
<div class="field">
|
| 402 |
<label>API ENDPOINT</label>
|
| 403 |
+
<input type="text" id="apiUrl" value="/diarize" />
|
| 404 |
</div>
|
| 405 |
<div class="field">
|
| 406 |
<label>SPEAKERS (blank = auto)</label>
|
|
|
|
| 462 |
|
| 463 |
let selectedFile = null;
|
| 464 |
|
| 465 |
+
// Default to same-origin API on hosted deployments (e.g., Hugging Face Spaces).
|
| 466 |
+
const apiUrlInput = document.getElementById('apiUrl');
|
| 467 |
+
if (apiUrlInput && (!apiUrlInput.value || apiUrlInput.value.includes('localhost'))) {
|
| 468 |
+
apiUrlInput.value = `/diarize`;
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
// ββ File Handling ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 472 |
document.getElementById('audioFile').addEventListener('change', (e) => {
|
| 473 |
const file = e.target.files[0];
|
|
|
|
| 627 |
</script>
|
| 628 |
</body>
|
| 629 |
</html>
|
| 630 |
+
|
| 631 |
+
|