Spaces:
Running
Running
Mandark-droid
commited on
Commit
·
eaed1a0
1
Parent(s):
af84cbc
Migrate Logo.png from Git LFS to HuggingFace XET storage
Browse files- Update .gitattributes to use XET filter for PNG files
- Add GitHub raw URL fallback for logo loading in report_cards.py
- Enable compatibility with HuggingFace Spaces binary file requirements
- .gitattributes +1 -1
- components/report_cards.py +8 -0
.gitattributes
CHANGED
|
@@ -33,4 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
-
*.png filter=
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.png filter=xet diff=exif merge=binary -text
|
components/report_cards.py
CHANGED
|
@@ -13,10 +13,18 @@ from pathlib import Path
|
|
| 13 |
def _get_logo_base64():
|
| 14 |
"""Load and encode TraceMind logo as base64"""
|
| 15 |
try:
|
|
|
|
| 16 |
logo_path = Path(__file__).parent.parent / "Logo.png"
|
| 17 |
if logo_path.exists():
|
| 18 |
with open(logo_path, "rb") as f:
|
| 19 |
return base64.b64encode(f.read()).decode()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
except Exception as e:
|
| 21 |
print(f"Warning: Could not load logo: {e}")
|
| 22 |
return None
|
|
|
|
| 13 |
def _get_logo_base64():
|
| 14 |
"""Load and encode TraceMind logo as base64"""
|
| 15 |
try:
|
| 16 |
+
# Try local file first (for development and GitHub)
|
| 17 |
logo_path = Path(__file__).parent.parent / "Logo.png"
|
| 18 |
if logo_path.exists():
|
| 19 |
with open(logo_path, "rb") as f:
|
| 20 |
return base64.b64encode(f.read()).decode()
|
| 21 |
+
|
| 22 |
+
# Fallback: fetch from GitHub raw URL (for HuggingFace Spaces)
|
| 23 |
+
import urllib.request
|
| 24 |
+
github_logo_url = "https://raw.githubusercontent.com/Mandark-droid/TraceMind-AI/main/Logo.png"
|
| 25 |
+
with urllib.request.urlopen(github_logo_url, timeout=5) as response:
|
| 26 |
+
return base64.b64encode(response.read()).decode()
|
| 27 |
+
|
| 28 |
except Exception as e:
|
| 29 |
print(f"Warning: Could not load logo: {e}")
|
| 30 |
return None
|