cfoli commited on
Commit
44506cf
·
verified ·
1 Parent(s): a204636

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -280,8 +280,10 @@ def generate_query(formatted_predictions):
280
  What features of the chest X-ray image support the predicted condition(s)?
281
  """
282
 
283
- def predictionReportGenerator(vlm_model, image_path, system_prompt, query_prompt):
284
- image_ = Image.open(image_path).convert("RGB")
 
 
285
  messages = [
286
  {
287
  "role": "system",
@@ -351,7 +353,7 @@ def run_diagnosis(
351
  formatted_predictions = {label: output_probs[label] for label in predicted_classes}
352
 
353
  query_prompt = generate_query(formatted_predictions)
354
- explanation_ = predictionReportGenerator(vlm_model = VLM_model, image_path = input_image,
355
  system_prompt = VLM_SYSTEM_PROMPT, query_prompt = query_prompt)
356
 
357
  return "\n".join(predicted_classes), explanation_, output_probs
 
280
  What features of the chest X-ray image support the predicted condition(s)?
281
  """
282
 
283
+ def predictionReportGenerator(vlm_model, img_pil, system_prompt, query_prompt):
284
+ # image_ = Image.open(image_path).convert("RGB")
285
+ image_ = img_pil.convert("RGB")
286
+
287
  messages = [
288
  {
289
  "role": "system",
 
353
  formatted_predictions = {label: output_probs[label] for label in predicted_classes}
354
 
355
  query_prompt = generate_query(formatted_predictions)
356
+ explanation_ = predictionReportGenerator(vlm_model = VLM_model, img_pil = input_image,
357
  system_prompt = VLM_SYSTEM_PROMPT, query_prompt = query_prompt)
358
 
359
  return "\n".join(predicted_classes), explanation_, output_probs