diff --git a/app/js/ai_game.js b/app/js/ai_game.js index a5c9d11..a2c6640 100644 --- a/app/js/ai_game.js +++ b/app/js/ai_game.js @@ -1,6 +1,6 @@ function getLabelsSync() { const request = new XMLHttpRequest(); - request.open('GET', 'http://0.0.0.0:8000/labels', false); + request.open('GET', 'http://quickdraw-endpoints:8000/labels', false); request.send(null); if (request.status === 200) { @@ -211,7 +211,7 @@ function callPredictionAPI() { const imageBlob = extractImage(); const formData = new FormData(); formData.append('file', imageBlob); - fetch('http://0.0.0.0:8000/predict_with_file', { + fetch('http://quickdraw-endpoints:8000/predict_with_file', { method: 'POST', body: formData }) diff --git a/app/js/clock_game.js b/app/js/clock_game.js index 58f5d47..271d96d 100644 --- a/app/js/clock_game.js +++ b/app/js/clock_game.js @@ -18,7 +18,7 @@ const difficulty = new URLSearchParams(window.location.search).get('difficulty') function getLabelsSync() { const request = new XMLHttpRequest(); - request.open('GET', 'http://0.0.0.0:8000/labels', false); + request.open('GET', 'http://quickdraw-endpoints:8000/labels', false); request.send(null); if (request.status === 200) { @@ -154,7 +154,7 @@ function callPredictionAPI() { const imageBlob = extractImage(); const formData = new FormData(); formData.append('file', imageBlob); - fetch('http://0.0.0.0:8000/predict_with_file', { + fetch('http://quickdraw-endpoints:8000/predict_with_file', { method: 'POST', body: formData }) diff --git a/app/js/end_game.js b/app/js/end_game.js index 6d68d39..e2d26fa 100644 --- a/app/js/end_game.js +++ b/app/js/end_game.js @@ -27,7 +27,7 @@ document.addEventListener('DOMContentLoaded', () => { console.log('data to be sent:'); console.log(JSON.stringify(postData)); - fetch('http://0.0.0.0:8000/add_score', { + fetch('http://quickdraw-endpoints:8000/add_score', { method: 'POST', headers: { 'Content-Type': 'application/json' @@ -42,7 +42,7 @@ document.addEventListener('DOMContentLoaded', () => { console.error('Error:', error); }); - fetch(`http://0.0.0.0:8000/scores?mode=${mode}&difficulty=${difficulty}`) + fetch(`http://quickdraw-endpoints:8000/scores?mode=${mode}&difficulty=${difficulty}`) .then(response => response.json()) .then(data => { console.log('Podium data:', data); diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4c63003 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +version: '3.8' + +services: + quickdraw-endpoints: + image: ghcr.io/mlengineershub/quickdraw-endpoints:latest + container_name: quickdraw-endpoints + ports: + - "8000:8000" + networks: + - quickdraw-network + + quickdraw: + image: ghcr.io/mlengineershub/quickdraw:latest + container_name: quickdraw + ports: + - "5500:80" + depends_on: + - quickdraw-endpoints + networks: + - quickdraw-network + +networks: + quickdraw-network: + driver: bridge diff --git a/endpoints/predict_cpu.py b/endpoints/predict_cpu.py index c2b6cce..0ee2ba8 100644 --- a/endpoints/predict_cpu.py +++ b/endpoints/predict_cpu.py @@ -49,7 +49,7 @@ # Set up CORS middleware app.add_middleware( CORSMiddleware, - allow_origins=[f"http://{host}:{app_port}"], + allow_origins=["*"], allow_credentials=True, allow_methods=["GET", "POST"], allow_headers=["*"] diff --git a/endpoints/predict_gpu.py b/endpoints/predict_gpu.py index 2cf63b3..7d4c330 100644 --- a/endpoints/predict_gpu.py +++ b/endpoints/predict_gpu.py @@ -49,7 +49,7 @@ # Set up CORS middleware app.add_middleware( CORSMiddleware, - allow_origins=[f"http://{host}:{app_port}"], + allow_origins=["*"], allow_credentials=True, allow_methods=["GET", "POST"], allow_headers=["*"] diff --git a/endpoints/predict_mps.py b/endpoints/predict_mps.py index b3bfb10..916509a 100644 --- a/endpoints/predict_mps.py +++ b/endpoints/predict_mps.py @@ -50,7 +50,7 @@ # Set up CORS middleware app.add_middleware( CORSMiddleware, - allow_origins=[f"http://{host}:{app_port}"], + allow_origins=["*"], allow_credentials=True, allow_methods=["GET", "POST"], allow_headers=["*"]