Spaces:
Running
Running
updating page since hugging face uses reverse proxy
Browse files- frontend/src/App.js +7 -8
frontend/src/App.js
CHANGED
|
@@ -76,16 +76,15 @@ const getAPIURL = () => {
|
|
| 76 |
|
| 77 |
// Get current protocol (http: or https:)
|
| 78 |
const protocol = window.location.protocol;
|
|
|
|
| 79 |
|
| 80 |
-
//
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
const currentPort = window.location.port;
|
| 84 |
-
if (currentPort === '7860') {
|
| 85 |
-
return `${protocol}//${window.location.hostname}:${currentPort}`;
|
| 86 |
-
} else {
|
| 87 |
-
return `${protocol}//${window.location.hostname}:8000`;
|
| 88 |
}
|
|
|
|
|
|
|
|
|
|
| 89 |
};
|
| 90 |
|
| 91 |
const API_URL = process.env.REACT_APP_API_URL || getAPIURL();
|
|
|
|
| 76 |
|
| 77 |
// Get current protocol (http: or https:)
|
| 78 |
const protocol = window.location.protocol;
|
| 79 |
+
const hostname = window.location.hostname;
|
| 80 |
|
| 81 |
+
// For Hugging Face deployment - use the same URL without specifying port
|
| 82 |
+
if (hostname.includes('hf.space')) {
|
| 83 |
+
return `${protocol}//${hostname}`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
}
|
| 85 |
+
|
| 86 |
+
// When running in other production environments, use port 8000
|
| 87 |
+
return `${protocol}//${hostname}:8000`;
|
| 88 |
};
|
| 89 |
|
| 90 |
const API_URL = process.env.REACT_APP_API_URL || getAPIURL();
|