cvips
commited on
Commit
·
60372e5
1
Parent(s):
4fa08fd
biomedparse+biomedllama_3b_multimodal
Browse files
app.py
CHANGED
@@ -385,11 +385,11 @@ def process_image(image_path, user_prompt, modality=None):
|
|
385 |
# First loop: collect prompts found in the analysis
|
386 |
found_prompts = []
|
387 |
for idx, prompt in enumerate(relevant_prompts):
|
388 |
-
|
389 |
-
|
390 |
-
color_name = {(255,0,0): "red", (0,255,0): "green", (0,0,255): "blue",
|
391 |
(255,255,0): "yellow", (255,0,255): "magenta"}[color]
|
392 |
-
|
|
|
393 |
found_prompts.append(prompt)
|
394 |
|
395 |
# Second loop: only process prompts found in analysis
|
@@ -418,7 +418,7 @@ def process_image(image_path, user_prompt, modality=None):
|
|
418 |
|
419 |
if not results:
|
420 |
results = [image] # Return original image if no overlays were created
|
421 |
-
detailed_analysis += "
|
422 |
if color_descriptions:
|
423 |
detailed_analysis += " " + " ".join(color_descriptions) + "."
|
424 |
else:
|
|
|
385 |
# First loop: collect prompts found in the analysis
|
386 |
found_prompts = []
|
387 |
for idx, prompt in enumerate(relevant_prompts):
|
388 |
+
color = colors[idx % len(colors)]
|
389 |
+
color_name = {(255,0,0): "red", (0,255,0): "green", (0,0,255): "blue",
|
|
|
390 |
(255,255,0): "yellow", (255,0,255): "magenta"}[color]
|
391 |
+
if prompt in detailed_analysis.lower():
|
392 |
+
color_descriptions.append(f"The {prompt} is highlighted in {color_name} color for reference")
|
393 |
found_prompts.append(prompt)
|
394 |
|
395 |
# Second loop: only process prompts found in analysis
|
|
|
418 |
|
419 |
if not results:
|
420 |
results = [image] # Return original image if no overlays were created
|
421 |
+
detailed_analysis += ""
|
422 |
if color_descriptions:
|
423 |
detailed_analysis += " " + " ".join(color_descriptions) + "."
|
424 |
else:
|