Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -339,13 +339,13 @@ def run_diagnosis(
|
|
| 339 |
Idx2labels[i] for i, p in enumerate(probs) if p >= threshold]
|
| 340 |
|
| 341 |
explanation_ = "No prediction was made."
|
| 342 |
-
if predicted_classes
|
| 343 |
# Load model (cache for speed)
|
| 344 |
-
if
|
| 345 |
-
VLM_MODEL_CACHE[
|
| 346 |
model = VLM_REGISTRY[vlm_name],
|
| 347 |
trust_remote_code = True)
|
| 348 |
-
VLM_model = VLM_MODEL_CACHE[
|
| 349 |
|
| 350 |
formatted_predictions = {label: output_probs[label] for label in predicted_classes}
|
| 351 |
|
|
|
|
| 339 |
Idx2labels[i] for i, p in enumerate(probs) if p >= threshold]
|
| 340 |
|
| 341 |
explanation_ = "No prediction was made."
|
| 342 |
+
if predicted_classes:
|
| 343 |
# Load model (cache for speed)
|
| 344 |
+
if vlm_name not in VLM_MODEL_CACHE:
|
| 345 |
+
VLM_MODEL_CACHE[vlm_name] = pipeline(task = "image-text-to-text",
|
| 346 |
model = VLM_REGISTRY[vlm_name],
|
| 347 |
trust_remote_code = True)
|
| 348 |
+
VLM_model = VLM_MODEL_CACHE[vlm_name]
|
| 349 |
|
| 350 |
formatted_predictions = {label: output_probs[label] for label in predicted_classes}
|
| 351 |
|