Skip to content

Commit

Permalink
docker compose file trial + containers updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanaliouchouche committed May 20, 2024
1 parent 03bba5b commit d35cf69
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/js/ai_game.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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
})
Expand Down
4 changes: 2 additions & 2 deletions app/js/clock_game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
})
Expand Down
4 changes: 2 additions & 2 deletions app/js/end_game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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);
Expand Down
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion endpoints/predict_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=["*"]
Expand Down
2 changes: 1 addition & 1 deletion endpoints/predict_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=["*"]
Expand Down
2 changes: 1 addition & 1 deletion endpoints/predict_mps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=["*"]
Expand Down

0 comments on commit d35cf69

Please sign in to comment.