Summary
I have a rather large HTML-file on another server, which I want to embed in my streamlit app via the components.iframe()
method. My problem is, that after interactions with the app, the iframe is being reloaded and this takes too much time. Therefore I wanted to cache the iframe, but this doesn’t work.
Steps to reproduce
Code snippet:
import streamlit as st
import streamlit.components.v1 as components
@st.cache
def load_site(url):
return components.iframe(url)
load_site(my_url)
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
I would expect that streamlit creates and caches the iframe object and displays it even after interactions on the page.
Actual behavior:
The iframe is rendered, but guessing from the loading times it is not cached. It also disappears and appears again which shouldn’t happen. On top, I get the following error:
While caching the return value of
load_site()
, Streamlit encountered an object of typestreamlit.delta_generator.DeltaGenerator
, which it does not know how to hash. To address this, please try helping Streamlit understand how to hash that type by passing thehash_funcs
argument into@st.cache
. For example:
Additional information
I don’t know how to hash a streamlit.delta_generator.DeltaGenerator object and don’t even know if what I’m trying to achieve is even possible or if another approach could achieve this.