UDHOV commited on
Commit
85092d0
·
1 Parent(s): 9db27c2

Fix Kalimati font path for HF Spaces

Browse files
Files changed (1) hide show
  1. 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 / Linux (installed via apt fonts-noto in Dockerfile)
165
- '/usr/share/fonts/truetype/noto/NotoSansDevanagari-Regular.ttf',
166
- '/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf',
167
- # Local development
 
 
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
- st.warning("⚠️ Nepali font not found. Devanagari text may display as squares. "
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