cfoli commited on
Commit
9108ad3
·
verified ·
1 Parent(s): 0bbb9a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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 not []:
343
  # Load model (cache for speed)
344
- if model_key not in MODEL_CACHE:
345
- VLM_MODEL_CACHE[model_key] = pipeline(task = "image-text-to-text",
346
  model = VLM_REGISTRY[vlm_name],
347
  trust_remote_code = True)
348
- VLM_model = VLM_MODEL_CACHE[model_key]
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