Skip to content

Commit

Permalink
Fix tests and Warmup path
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd committed Jan 23, 2024
1 parent f78c5bc commit bb809d0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions backend/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ async def imageupload(
extras_logging["bg_label"] = label
extras_logging["bg_confidence"] = confidence
extras_logging["bg_model_time"] = round(time.time() - start, 2)
if confidence < 76:
if confidence < 0.76:
extras_logging["bg_confidence_level"] = "low"
elif confidence < 99:
elif confidence < 0.99:
extras_logging["bg_confidence_level"] = "medium"
else:
extras_logging["bg_confidence_level"] = "high"
Expand Down
4 changes: 2 additions & 2 deletions backend/src/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def load_model_inference(model_path: str):
Model: loaded model ready for prediction and Warmud-up
"""
model = YOLO(model_path)
test = Image.open("./Warmup.jpg")
test = Image.open("./src/Warmup.jpg")
model(test, verbose=False)
return model

Expand All @@ -51,4 +51,4 @@ def predict_image(model, img: bytes) -> Union[str, float]:
predicted_class = results[0].probs.top5[0]
label = CLASSES[predicted_class]
confidence = float(results[0].probs.top5conf[0])
return (label, 100*confidence)
return (label, confidence)
Binary file removed backend/tests/Warmup.jpg
Binary file not shown.
4 changes: 2 additions & 2 deletions frontend/src/components/ResultPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ function sendFeedback (isCorrect: boolean) {
<DsfrTag
class="fr-tag--sm success-tag"
>
Indice de fiabilité : {{ Math.floor(confidence) }}%
Indice de fiabilité : {{ Math.floor(confidence * 100) }}%
</DsfrTag>
</div>
<div v-else>
<DsfrTag
class="fr-tag--sm warning-tag"
>
Indice de fiabilité : {{ Math.floor(confidence) }}%
Indice de fiabilité : {{ Math.floor(confidence * 100) }}%
</DsfrTag>
<p class="warning-text">
Nous vous conseillons de faire appel à un expert pour confirmer cette réponse.
Expand Down

0 comments on commit bb809d0

Please sign in to comment.