raidAthmaneBenlala commited on
Commit
9d8ec5b
·
1 Parent(s): 62fa15c

fix: update api_base for dev/prod and make model checkpoints path dynamic

Browse files
toothmap_backend/main.py CHANGED
@@ -20,7 +20,11 @@ app.add_middleware(
20
  allow_headers=["*"],
21
  )
22
 
23
- CKPT_DIR = "/app/checkpoints"
 
 
 
 
24
  yolo_model = None
25
 
26
  @app.on_event("startup")
 
20
  allow_headers=["*"],
21
  )
22
 
23
+ # Dynamic checkpoint directory
24
+ if os.path.exists("/app/checkpoints"):
25
+ CKPT_DIR = "/app/checkpoints"
26
+ else:
27
+ CKPT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "checkpoints"))
28
  yolo_model = None
29
 
30
  @app.on_event("startup")
toothmap_frontend/src/App.jsx CHANGED
@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from 'react';
2
  import axios from 'axios';
3
  import { UploadCloud, Activity, Loader2, ScanLine, Search } from 'lucide-react';
4
 
5
- const API_BASE = "";
6
 
7
  const QUADRANT_COLOURS = ['#3b82f6', '#22c55e', '#f59e0b', '#ef4444'];
8
  const UPPER_TEETH = [18, 17, 16, 15, 14, 13, 12, 11, 21, 22, 23, 24, 25, 26, 27, 28];
 
2
  import axios from 'axios';
3
  import { UploadCloud, Activity, Loader2, ScanLine, Search } from 'lucide-react';
4
 
5
+ const API_BASE = import.meta.env.DEV ? "http://localhost:8000" : "";
6
 
7
  const QUADRANT_COLOURS = ['#3b82f6', '#22c55e', '#f59e0b', '#ef4444'];
8
  const UPPER_TEETH = [18, 17, 16, 15, 14, 13, 12, 11, 21, 22, 23, 24, 25, 26, 27, 28];