-1

我正在尝试在 Streamlit 网页上绘制 pyLDAvis。我正在将以前保存的 picklefiles 加载为二进制文件。当我运行以下代码时:

import streamlit as st
import pickle
import pyLDAvis.gensim_models
import streamlit.components.v1 as components

# loading pickle data file from previously ran local notebook
bow_corpus = pickle.load(open(localpath + bow_corpus, "rb"))
dictionary = pickle.load(open(localpath + dictionary, "rb"))
lda_tfidf_model = pickle.load(open(localpath + lda_tfidf_model, "rb"))

if st.button('Generate pyLDAvis'):
    prepared_pyLDAvis_tfidf = pyLDAvis.gensim_models.prepare(
        lda_tfidf_model,
        bow_corpus,
        dictionary,
        sort_topics=False
    )

    html_string = pyLDAvis.prepared_data_to_html(prepared_pyLDAvis_tfidf)
    components.html(html_string, width=1300, height=800, scrolling=True)

我收到此错误:

TypeError: object of type 'NoneType' has no len()
4

0 回答 0