D Ф m i И i q ц e L Ф y e r commited on
Commit
5985437
·
1 Parent(s): e70050b

Add backend toggle Local/HF Space

Browse files
Files changed (1) hide show
  1. syscred/static/index.html +11 -1
syscred/static/index.html CHANGED
@@ -393,7 +393,17 @@
393
  </div>
394
 
395
  <script>
396
- const API_URL = 'http://localhost:5001';
 
 
 
 
 
 
 
 
 
 
397
 
398
  async function analyzeUrl() {
399
  const urlInput = document.getElementById('urlInput');
 
393
  </div>
394
 
395
  <script>
396
+ // Auto-detect API URL based on environment
397
+ const API_URL = (() => {
398
+ const hostname = window.location.hostname;
399
+ if (hostname.includes('huggingface.co') || hostname.includes('hf.space')) {
400
+ return '';
401
+ } else if (hostname.includes('onrender.com')) {
402
+ return '';
403
+ } else {
404
+ return 'http://localhost:5001';
405
+ }
406
+ })();
407
 
408
  async function analyzeUrl() {
409
  const urlInput = document.getElementById('urlInput');