Spaces:
Running
Running
Amit
commited on
Commit
·
663d76d
1
Parent(s):
751ed9e
Fix: Use Markdown for image explanation for better visibility
Browse files
app.py
CHANGED
|
@@ -687,14 +687,10 @@ with demo:
|
|
| 687 |
)
|
| 688 |
|
| 689 |
# Image Explanation - Why this image?
|
| 690 |
-
image_explanation = gr.
|
| 691 |
value="",
|
| 692 |
visible=False,
|
| 693 |
-
|
| 694 |
-
interactive=False,
|
| 695 |
-
elem_classes=["image-explanation"],
|
| 696 |
-
show_label=False,
|
| 697 |
-
container=False
|
| 698 |
)
|
| 699 |
|
| 700 |
# Controls Group (moved below image)
|
|
@@ -797,10 +793,9 @@ with demo:
|
|
| 797 |
def visualize_wrapper(session_id):
|
| 798 |
image, explanation, pip_svg, status = visualize_mood_sync(session_id)
|
| 799 |
print(f"[DEBUG] Visualize - explanation: '{explanation}' (len={len(explanation) if explanation else 0})")
|
| 800 |
-
# Show explanation
|
| 801 |
if explanation and len(explanation.strip()) > 0:
|
| 802 |
-
|
| 803 |
-
formatted_explanation = f'"{explanation}"'
|
| 804 |
print(f"[DEBUG] Formatted: {formatted_explanation}")
|
| 805 |
return image, gr.update(value=formatted_explanation, visible=True), pip_svg, status
|
| 806 |
print("[DEBUG] No explanation - hiding")
|
|
@@ -818,9 +813,9 @@ with demo:
|
|
| 818 |
summary, image, explanation, audio, pip_svg, status = create_memory_sync(session_id, history)
|
| 819 |
print(f"[DEBUG] Memory - explanation: '{explanation}'")
|
| 820 |
|
| 821 |
-
# Format explanation
|
| 822 |
if explanation and len(explanation.strip()) > 0:
|
| 823 |
-
formatted_explanation = f'"{explanation}"'
|
| 824 |
explanation_update = gr.update(value=formatted_explanation, visible=True)
|
| 825 |
else:
|
| 826 |
explanation_update = gr.update(value="", visible=False)
|
|
|
|
| 687 |
)
|
| 688 |
|
| 689 |
# Image Explanation - Why this image?
|
| 690 |
+
image_explanation = gr.Markdown(
|
| 691 |
value="",
|
| 692 |
visible=False,
|
| 693 |
+
elem_classes=["image-explanation"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
)
|
| 695 |
|
| 696 |
# Controls Group (moved below image)
|
|
|
|
| 793 |
def visualize_wrapper(session_id):
|
| 794 |
image, explanation, pip_svg, status = visualize_mood_sync(session_id)
|
| 795 |
print(f"[DEBUG] Visualize - explanation: '{explanation}' (len={len(explanation) if explanation else 0})")
|
| 796 |
+
# Show explanation as markdown
|
| 797 |
if explanation and len(explanation.strip()) > 0:
|
| 798 |
+
formatted_explanation = f'*"{explanation}"*'
|
|
|
|
| 799 |
print(f"[DEBUG] Formatted: {formatted_explanation}")
|
| 800 |
return image, gr.update(value=formatted_explanation, visible=True), pip_svg, status
|
| 801 |
print("[DEBUG] No explanation - hiding")
|
|
|
|
| 813 |
summary, image, explanation, audio, pip_svg, status = create_memory_sync(session_id, history)
|
| 814 |
print(f"[DEBUG] Memory - explanation: '{explanation}'")
|
| 815 |
|
| 816 |
+
# Format explanation as italic markdown
|
| 817 |
if explanation and len(explanation.strip()) > 0:
|
| 818 |
+
formatted_explanation = f'*"{explanation}"*'
|
| 819 |
explanation_update = gr.update(value=formatted_explanation, visible=True)
|
| 820 |
else:
|
| 821 |
explanation_update = gr.update(value="", visible=False)
|