Сбой приложения колбы Heroku: модуль importlib.util не найден Ошибка - PullRequest
0 голосов
/ 27 ноября 2018

Я пытаюсь развернуть приложение фляги с Heroku, и я получаю ModuleNotFoundError.Я не понимаю почему, потому что все мои модули обновлены.Кто-нибудь знает, как исправить эту ошибку?

CMD image

Вот код, который я использую.Код строится нормально, я просто не могу заставить приложение правильно развернуться.

import pickle
from flask import Flask
from flask import request,jsonify,render_template,abort
import pandas as pd
from sklearn.externals import joblib
import json
import numpy as np
from importlib import util

app = Flask(__name__)

model = pickle.load(open("Final_Gait_Model.sav", "rb"))

@app.route('/')
def home():
    return render_template('index.html')

@app.route('/api', methods=['POST'])
def get_info_predict():

    features = []
    result = request.form

    L_Ank_Force_LHS = float(input('Left Ankle Force at LHS (N): '))
    features.append(L_Ank_Force_LHS)

    L_Ank_Moment_Z_LHS = float(input('Left Ankle Moment (Z-axis) at LHS (Nm): '))
    features.append(L_Ank_Moment_Z_LHS)

    L_Knee_Force_LHS = float(input('Left Knee Force at LHS (N): '))
    features.append(L_Knee_Force_LHS)

    L_Ank_Moment_Y_Stance=float(input('Left Ankle Moment (Y-axis) during stance (Nm): '))
    features.append(L_Ank_Moment_Y_Stance)

    L_Knee_Vel_Y_Stance=float(input('Left Knee Angular Velocity (Y-axis) during stance (deg/s): '))
    features.append(L_Knee_Vel_Y_Stance)

    L_Knee_Vel_Z_Stance=float(input('Left Knee Angular Velocity (Z-Axis) during stance (deg/s): '))
    features.append(L_Knee_Vel_Z_Stance)

    R_Ank_Moment_Y_Stance=float(input('Right Ankle Moment (Y-axis) during stance (Nm): '))
    features.append(R_Ank_Moment_Y_Stance)

    R_Knee_Vel_Y_Stance=float(input('Right Knee Angular Velocity (Y-axis) during stance (deg/s): '))
    features.append(R_Knee_Vel_Y_Stance)

    R_Knee_Vel_Z_Stance=float(input('Right Knee Angular Velocity (Z-axis) during stance (deg/s): '))
    features.append(R_Knee_Vel_Z_Stance)

    R_Ank_Force_RHS=float(input('Right Ankle Force at RHS (N): '))
    features.append(R_Ank_Force_RHS)

    R_Ank_Moment_Z_RHS=float(input('Right Ankle Moment (Z-axis) at RHS (Nm): '))
    features.append(R_Ank_Moment_Z_RHS)

    R_Knee_Force_RHS=float(input('Right Kneed Force at RHS (N): '))
    features.append(R_Knee_Force_RHS)

    features = input_to_one_hot(features)

    prediction = model.predict([features])[0]

    return json.dumps({'Injury Classisfication':prediction});


if __name__ == '__main__':
    app.run(port=8080, debug = True)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...