Spaces:
Sleeping
Sleeping
Fix Kalimati font path for HF Spaces
Browse files- src/streamlit_app.py +7 -6
src/streamlit_app.py
CHANGED
|
@@ -161,10 +161,12 @@ st.markdown("""
|
|
| 161 |
def load_nepali_font():
|
| 162 |
"""Load Nepali font for matplotlib visualizations."""
|
| 163 |
font_paths = [
|
| 164 |
-
# HF Spaces /
|
| 165 |
-
'/
|
| 166 |
-
|
| 167 |
-
|
|
|
|
|
|
|
| 168 |
'fonts/Kalimati.ttf',
|
| 169 |
# macOS
|
| 170 |
'/System/Library/Fonts/Supplemental/DevanagariSangamMN.ttc',
|
|
@@ -181,8 +183,7 @@ def load_nepali_font():
|
|
| 181 |
except Exception:
|
| 182 |
continue
|
| 183 |
|
| 184 |
-
|
| 185 |
-
"Place Kalimati.ttf in 'fonts/' directory for proper display.")
|
| 186 |
return None
|
| 187 |
|
| 188 |
|
|
|
|
| 161 |
def load_nepali_font():
|
| 162 |
"""Load Nepali font for matplotlib visualizations."""
|
| 163 |
font_paths = [
|
| 164 |
+
# HF Spaces / Docker — Kalimati downloaded by Dockerfile into /app/fonts/
|
| 165 |
+
'/app/fonts/Kalimati.ttf',
|
| 166 |
+
# Kalimati registered system-wide by fc-cache in Dockerfile
|
| 167 |
+
'/usr/local/share/fonts/nepali/Kalimati.ttf',
|
| 168 |
+
# Local development (absolute path relative to script)
|
| 169 |
+
os.path.join(BASE_DIR, 'fonts', 'Kalimati.ttf'),
|
| 170 |
'fonts/Kalimati.ttf',
|
| 171 |
# macOS
|
| 172 |
'/System/Library/Fonts/Supplemental/DevanagariSangamMN.ttc',
|
|
|
|
| 183 |
except Exception:
|
| 184 |
continue
|
| 185 |
|
| 186 |
+
# Silent failure — charts still render, just without Devanagari-specific glyphs
|
|
|
|
| 187 |
return None
|
| 188 |
|
| 189 |
|