raidAthmaneBenlala commited on
Commit
03a23e0
·
1 Parent(s): 6adb222

✨ Add global teeth count to all analysis modes

Browse files
Files changed (1) hide show
  1. toothmap_frontend/src/App.jsx +9 -5
toothmap_frontend/src/App.jsx CHANGED
@@ -69,7 +69,7 @@ export default function App() {
69
  }
70
  } catch (e) {
71
  console.error(e);
72
- alert("Error: " + (e.response ? e.response.status + " - " + JSON.stringify(e.response.data) : e.message));
73
  } finally {
74
  setLoading(false);
75
  }
@@ -213,17 +213,21 @@ export default function App() {
213
  )}
214
 
215
  {/* Stats Panel */}
216
- {pipelineResults && (
217
  <div className="bg-zinc-800/30 rounded-lg p-3 text-sm">
218
  <p className="text-zinc-400 text-xs mb-1">Detected Teeth</p>
219
- <p className="text-2xl font-bold text-white">{pipelineResults.length}</p>
220
- {pipelineResults.slice(0,6).map((r, i) => (
 
 
221
  <div key={i} className="flex justify-between text-xs text-zinc-500 mt-1">
222
  <span style={{ color: getColour(r.fdi) }}>FDI {r.fdi > 0 ? r.fdi : '?'}</span>
223
  <span>{(r.confidence * 100).toFixed(0)}% conf</span>
224
  </div>
225
  ))}
226
- {pipelineResults.length > 6 && <p className="text-xs text-zinc-600 mt-1">+{pipelineResults.length - 6} more...</p>}
 
 
227
  </div>
228
  )}
229
  </aside>
 
69
  }
70
  } catch (e) {
71
  console.error(e);
72
+ alert("Error contacting the AI server. Ensure the FastAPI server is running on port 8000.");
73
  } finally {
74
  setLoading(false);
75
  }
 
213
  )}
214
 
215
  {/* Stats Panel */}
216
+ {(pipelineResults || rawBoxes) && (
217
  <div className="bg-zinc-800/30 rounded-lg p-3 text-sm">
218
  <p className="text-zinc-400 text-xs mb-1">Detected Teeth</p>
219
+ <p className="text-2xl font-bold text-white">
220
+ {pipelineResults ? pipelineResults.length : rawBoxes.boxes.length}
221
+ </p>
222
+ {pipelineResults && pipelineResults.slice(0,6).map((r, i) => (
223
  <div key={i} className="flex justify-between text-xs text-zinc-500 mt-1">
224
  <span style={{ color: getColour(r.fdi) }}>FDI {r.fdi > 0 ? r.fdi : '?'}</span>
225
  <span>{(r.confidence * 100).toFixed(0)}% conf</span>
226
  </div>
227
  ))}
228
+ {pipelineResults && pipelineResults.length > 6 && (
229
+ <p className="text-xs text-zinc-600 mt-1">+{pipelineResults.length - 6} more...</p>
230
+ )}
231
  </div>
232
  )}
233
  </aside>