Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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,
|
| 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,
|
| 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
|