s4um1l commited on
Commit
0af2618
·
1 Parent(s): ba10a58

updating page since hugging face uses reverse proxy

Browse files
Files changed (1) hide show
  1. 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
- // When running in production, use the same host with the backend port
81
- // This works because we're exposing the backend port in docker-compose
82
- // If port is 7860, use the same port (Hugging Face scenario)
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();