When I run streamlit run, I can upload images without error and they are displayed as I wrote them,
But when I upload to streamlit sharing, I get the error below
OSError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 379, in _run_script
exec(code, module.__dict__)
File "/app/face_api_streamlit/main.py", line 74, in <module>
draw_text(result)
File "/app/face_api_streamlit/main.py", line 44, in draw_text
text, font = get_draw_text(faceDictionary)
File "/app/face_api_streamlit/main.py", line 34, in get_draw_text
font = ImageFont.truetype('Arial', font_size)
File "/home/appuser/venv/lib/python3.7/site-packages/PIL/ImageFont.py", line 855, in truetype
return freetype(font)
File "/home/appuser/venv/lib/python3.7/site-packages/PIL/ImageFont.py", line 852, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/home/appuser/venv/lib/python3.7/site-packages/PIL/ImageFont.py", line 212, in __init__
font, size, index, encoding, layout_engine=layout_engine
What I did for fixing.
I changed the codes like below and run it but not resolved yet…
font = ImageFont.truetype(font='/System/Library/Fonts/Arial', size=20, index=0, encoding='', layout_engine=None)
font_path = '/System/Library/Fonts/Arial'
font = ImageFont.truetype(font=font_path, size=20, index=0, encoding='', layout_engine=None)
Mac OS
Python 3.9.2
Streamlit 1.4.0