Hi guys,
I am trying to create a heatmap from an Rscript into my Streamlit app. I click on a button and it’s calling the Rscript, running the data and saving the heatmap as a pdf in my repo.
It runs on my local machine but not during the deployment on Streamlit.io.
Is R available in deployment?
Here is the code:
process = subprocess.Popen(["Rscript", "heatmap.R"])#, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
result = process.communicate()
def displayPDF(file):
# Opening file from file path
with open(file, "rb") as f:
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
# Embedding PDF in HTML
pdf_display = F'<iframe src="data:application/pdf;base64,{base64_pdf}" width="700" height="1000" type="application/pdf"></iframe>'
# Displaying File
st.markdown(pdf_display, unsafe_allow_html=True)
I have a requirements.txt file with my python libraries and a packages.txt file for R with the following :
r-base
r-base-dev
r-cran-gplots
r-cran-gplot2
Thank you guys, any help is appreciated!