我正在尝试在Flask中运行机器学习模型。
我已经用Sublime Text编写了Flask代码,
from flask import Flask, request, render_template, jsonify
import base64
import numpy as np
import io
from PIL import Image
import keras
from keras.models import Sequential, load_model
from keras.preprocessing.image import ImageDataGenerator, img_to_array
def get_model():
global model
model = load_model('model_new.h5')
model._make_predict_function()
print("Model Loaded")
print("Loading Model...")
get_model()
app = Flask(__name__)
@app.route('/')
def welcome():
return render_template("index.html")
当我尝试从命令提示符运行代码时,它显示出这样的错误,
Traceback (most recent call last):
File "C:\Users\adity\Anaconda3\envs\PythonGPU\lib\site-packages\flask\cli.py", line 240, in locate_app
__import__(module_name)
File "D:\flask\app.py", line 4, in <module>
import numpy as np
File "C:\Users\adity\Anaconda3\envs\PythonGPU\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\adity\Anaconda3\envs\PythonGPU\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
我不知道为什么说numpy导入错误...
即使一切都已正确安装并正常运行,请帮助!