Fix API port mismatch and improve error handling

This commit is contained in:
Aherobo Ovie Victor
2025-07-11 21:43:33 +01:00
parent bdc171b009
commit 0e49829d23
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -1,6 +1,6 @@
// Memory Module Detection QA Interface JavaScript // Memory Module Detection QA Interface JavaScript
const API_BASE_URL = 'http://localhost:5001'; const API_BASE_URL = 'http://localhost:5002';
let uploadedFile = null; let uploadedFile = null;
// Initialize the application // Initialize the application
@@ -288,8 +288,16 @@ async function testHardcodedImage() {
showLoading('Testing hardcoded image...'); showLoading('Testing hardcoded image...');
try { try {
console.log(`Making request to: ${API_BASE_URL}/detect/hardcoded?confidence=0.8`);
const response = await fetch(`${API_BASE_URL}/detect/hardcoded?confidence=0.8`); const response = await fetch(`${API_BASE_URL}/detect/hardcoded?confidence=0.8`);
console.log('Response status:', response.status);
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
const result = await response.json(); const result = await response.json();
console.log('Response data:', result);
hideLoading(); hideLoading();
if (result.success) { if (result.success) {
@@ -299,6 +307,7 @@ async function testHardcodedImage() {
} }
} catch (error) { } catch (error) {
hideLoading(); hideLoading();
console.error('Hardcoded test error:', error);
alert(`Error: ${error.message}`); alert(`Error: ${error.message}`);
} }
} }
+1 -1
View File
@@ -12,7 +12,7 @@ from PIL import Image
import io import io
# API base URL # API base URL
BASE_URL = "http://localhost:5001" BASE_URL = "http://localhost:5002"
def test_api_info(): def test_api_info():
"""Test the API info endpoint.""" """Test the API info endpoint."""