pykara commited on
Commit
1a79c50
·
1 Parent(s): 59df067

environment

Browse files
Files changed (1) hide show
  1. src/environments/environment.ts +16 -2
src/environments/environment.ts CHANGED
@@ -1,4 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  export const environment = {
2
- production: true,
3
- pyDetectApiUrl: 'https://pykara-Py-detect-backend.hf.space'
4
  };
 
1
+ const hostname = window.location.hostname;
2
+
3
+ // Local modes: ng serve, localhost, or IP on local network
4
+ const isLocal =
5
+ hostname === 'localhost' ||
6
+ hostname === '127.0.0.1' ||
7
+ hostname.startsWith('192.168.') ||
8
+ hostname.startsWith('10.');
9
+
10
+ // Decide API URL based on where the app is running
11
+ const pyDetectApiUrl = isLocal
12
+ ? 'http://127.0.0.1:5000' // your local Flask
13
+ : 'https://pykara-Py-detect-backend.hf.space'; // Hugging Face backend
14
+
15
  export const environment = {
16
+ production: !isLocal,
17
+ pyDetectApiUrl
18
  };