Commit Β·
b0950ec
1
Parent(s): 26c7cba
Fix CORS errors by replacing hardcoded localhost URLs with relative API paths
Browse files- Change /api/infer-aw-contour from http://localhost:8000/api/infer-aw-contour
- Change /api/infer-cervix-bbox from http://localhost:8000/api/infer-cervix-bbox
- Change /infer/image from http://localhost:8000/infer/image
- This allows frontend to work correctly in HF Space environment
- Relative URLs work on same origin as frontend in production
Fixes CORS error: 'Access to fetch... from origin has been blocked by CORS policy'
src/components/AceticAnnotator.tsx
CHANGED
|
@@ -168,7 +168,7 @@ const AceticAnnotatorComponent = forwardRef<AceticAnnotatorHandle, AceticAnnotat
|
|
| 168 |
|
| 169 |
console.log('π Sending to backend with image dimensions:', imageDimensions);
|
| 170 |
|
| 171 |
-
const backendResponse = await fetch('
|
| 172 |
method: 'POST',
|
| 173 |
body: formData,
|
| 174 |
});
|
|
|
|
| 168 |
|
| 169 |
console.log('π Sending to backend with image dimensions:', imageDimensions);
|
| 170 |
|
| 171 |
+
const backendResponse = await fetch('/api/infer-aw-contour', {
|
| 172 |
method: 'POST',
|
| 173 |
body: formData,
|
| 174 |
});
|
src/pages/AcetowhiteExamPage.tsx
CHANGED
|
@@ -176,7 +176,7 @@ export function AcetowhiteExamPage({ goBack, onNext }: Props) {
|
|
| 176 |
|
| 177 |
const formData = new FormData();
|
| 178 |
formData.append('file', blob, 'image.jpg');
|
| 179 |
-
const backendResponse = await fetch('
|
| 180 |
method: 'POST',
|
| 181 |
body: formData,
|
| 182 |
});
|
|
|
|
| 176 |
|
| 177 |
const formData = new FormData();
|
| 178 |
formData.append('file', blob, 'image.jpg');
|
| 179 |
+
const backendResponse = await fetch('/infer/image', {
|
| 180 |
method: 'POST',
|
| 181 |
body: formData,
|
| 182 |
});
|
src/pages/GreenFilterPage.tsx
CHANGED
|
@@ -232,7 +232,7 @@ export function GreenFilterPage({ goBack, onNext }: Props) {
|
|
| 232 |
|
| 233 |
const formData = new FormData();
|
| 234 |
formData.append('file', blob, 'image.jpg');
|
| 235 |
-
const backendResponse = await fetch('
|
| 236 |
method: 'POST',
|
| 237 |
body: formData,
|
| 238 |
});
|
|
|
|
| 232 |
|
| 233 |
const formData = new FormData();
|
| 234 |
formData.append('file', blob, 'image.jpg');
|
| 235 |
+
const backendResponse = await fetch('/infer/image', {
|
| 236 |
method: 'POST',
|
| 237 |
body: formData,
|
| 238 |
});
|
src/pages/GuidedCapturePage.tsx
CHANGED
|
@@ -244,7 +244,7 @@ export function GuidedCapturePage({ onNext, onGoToPatientRecords, initialMode, o
|
|
| 244 |
const formData = new FormData();
|
| 245 |
formData.append('file', blob, 'frame.jpg');
|
| 246 |
|
| 247 |
-
const response = await fetch('
|
| 248 |
method: 'POST',
|
| 249 |
body: formData,
|
| 250 |
});
|
|
@@ -548,7 +548,7 @@ export function GuidedCapturePage({ onNext, onGoToPatientRecords, initialMode, o
|
|
| 548 |
|
| 549 |
console.log('π Sending request to backend...');
|
| 550 |
// Call cervix bbox detection endpoint
|
| 551 |
-
const backendResponse = await fetch('
|
| 552 |
method: 'POST',
|
| 553 |
body: formData,
|
| 554 |
});
|
|
|
|
| 244 |
const formData = new FormData();
|
| 245 |
formData.append('file', blob, 'frame.jpg');
|
| 246 |
|
| 247 |
+
const response = await fetch('/infer/image', {
|
| 248 |
method: 'POST',
|
| 249 |
body: formData,
|
| 250 |
});
|
|
|
|
| 548 |
|
| 549 |
console.log('π Sending request to backend...');
|
| 550 |
// Call cervix bbox detection endpoint
|
| 551 |
+
const backendResponse = await fetch('/api/infer-cervix-bbox', {
|
| 552 |
method: 'POST',
|
| 553 |
body: formData,
|
| 554 |
});
|
src/pages/LugolExamPage.tsx
CHANGED
|
@@ -164,7 +164,7 @@ export function LugolExamPage({ goBack, onNext }: Props) {
|
|
| 164 |
|
| 165 |
const formData = new FormData();
|
| 166 |
formData.append('file', blob, 'image.jpg');
|
| 167 |
-
const backendResponse = await fetch('
|
| 168 |
method: 'POST',
|
| 169 |
body: formData,
|
| 170 |
});
|
|
|
|
| 164 |
|
| 165 |
const formData = new FormData();
|
| 166 |
formData.append('file', blob, 'image.jpg');
|
| 167 |
+
const backendResponse = await fetch('/infer/image', {
|
| 168 |
method: 'POST',
|
| 169 |
body: formData,
|
| 170 |
});
|