Nick Canu commited on
Commit
cc506a4
1 Parent(s): b8a644b

path fix for blog

Browse files
Files changed (1) hide show
  1. Home.py +3 -1
Home.py CHANGED
@@ -357,6 +357,7 @@ def application():
357
  st.button('Report', on_click=report, use_container_width=True)
358
 
359
  def blog():
 
360
  """
361
  Blog describing the Auto-BG project
362
  """
@@ -367,7 +368,8 @@ def blog():
367
  These concepts support general users and designers-to-be as alternatives to current concepts, seeds for future concepts, or an entertaining thought experiment.*")
368
 
369
  # Code adapted from "Display and Download PDF in Streamlit: A Blog Use Case" by My Data Talk, https://towardsdatascience.com/display-and-download-pdf-in-streamlit-a-blog-use-case-5fc1ac87d4b1
370
- with open('Auto_BG_blog.pdf', "rb") as blog_file:
 
371
  blog_pdf = base64.b64encode(blog_file.read()).decode('utf-8')
372
  blog_display = f'<center><iframe src="data:application/pdf;base64,{blog_pdf}" width=800 height=800 type="application/pdf"></iframe><center>'
373
 
 
357
  st.button('Report', on_click=report, use_container_width=True)
358
 
359
  def blog():
360
+ from pathlib import Path
361
  """
362
  Blog describing the Auto-BG project
363
  """
 
368
  These concepts support general users and designers-to-be as alternatives to current concepts, seeds for future concepts, or an entertaining thought experiment.*")
369
 
370
  # Code adapted from "Display and Download PDF in Streamlit: A Blog Use Case" by My Data Talk, https://towardsdatascience.com/display-and-download-pdf-in-streamlit-a-blog-use-case-5fc1ac87d4b1
371
+ path = Path(__file__).parent / 'Auto_BG_blog.pdf'
372
+ with open(path, "rb") as blog_file:
373
  blog_pdf = base64.b64encode(blog_file.read()).decode('utf-8')
374
  blog_display = f'<center><iframe src="data:application/pdf;base64,{blog_pdf}" width=800 height=800 type="application/pdf"></iframe><center>'
375