【发布时间】:2021-11-30 03:39:36
【问题描述】:
当我尝试运行我的 streamlit 应用程序时,我在 Anaconda Prompt 中收到这些错误:
我将代码简化为更具可读性,但基本上它使用 Keras 模型处理输入,然后我使用 pickle 保存此模型,以便之后使用 Streamlit API 进行预测
import streamlit as st
import cv2 as cv
import matplotlib.pyplot as plt
import pandas as pd
import os
import numpy as np
import keras
from keras.models import Sequential
import joblib
import pickle
def some_function():
pass #some function to preprocess data and train a model with Keras
def main():
ruta_to_model=r'path'
model = pickle.load(open(os.path.join(ruta_to_model,'model_pose.pkl'),'rb'))
st.set_page_config(page_title='Pose Framework',layout='wide',initial_sidebar_state='expanded')
files=[]
for file in os.listdir(r'path'):
if file.endswith('.jpg'):
files.append(file)
option=st.multiselect('Input:', files)
if option and st.button('Predict'):
inputs=some_function()
model.predict(inputs)
【问题讨论】:
-
我认为错误在
some_function()的某个地方,在你的预处理函数中