_JJang
January 20, 2024, 3:54am
1
I’m having a hard time in the streamlit deploy process.
Locally, the font of the graph appears normally.
However, if I just streamlit deploy, the font on the graph is broken, so you can’t see it.
Only the font in the graph is a problem.
To solve this problem
I tried to modify the font of the .streamlit/config.toml file, but it didn’t work
I’ve tried adding it to my Python code as below but it’s not working out.
I think there is no problem in local,
but it’s a problem in deploy process to a server
Please help me
import streamlit.components.v1 as components
components.html(“”"
body {
font-family: 'NanumGothic', sans serif;
}
“”“, “””, height=0)
Hi @_JJang
It seems that you’re using a local font type that is not present by default on the Community Cloud server.
You can include this font type in your app repo and call the font as implemented in the code snippet by @blackary
@dnaura This is not recommended for anything but a locally running streamlit app with no internet access, but there’s a hack you can do that moves the font file to wherever streamlit is installed on your machine, and then references that. CSS won't render in deployed app (using components.html())
If you have internet access, it’s much better to reference a file somewhere on the internet, but in your case this should work.
Here’s a working script:
import shutil
from pathlib import Path
import…
Hope this helps!
_JJang
January 21, 2024, 1:08am
3
Thank you for your very useful help.
Let’s try again.
Thank you.
1 Like
system
Closed
January 27, 2024, 11:08am
4
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.