llsourcell / how_to_deploy_a_keras_model_to_production Goto Github PK
View Code? Open in Web Editor NEWThis is the code for the "How to Deploy a Keras Model to Production" by Siraj Raval on Youtube
License: GNU General Public License v3.0
This is the code for the "How to Deploy a Keras Model to Production" by Siraj Raval on Youtube
License: GNU General Public License v3.0
I always have to modify your code to work for me, for example I add ( ) to print "".
when I tried to predict the image I am getting this error , TypeError: a bytes-like object is required, not 'str'
what should I do?
On requirements.txt the version numbers would be helpfull.
Traceback (most recent call last):
File "app.py", line 10, in
from flask import Flask, render_template,request
File "/home/abhay/anaconda2/lib/python2.7/site-packages/flask/init.py", line 19, in
from . import json
File "/home/abhay/anaconda2/lib/python2.7/site-packages/flask/json/init.py", line 25, in
import dataclasses
File "/home/abhay/anaconda2/lib/python2.7/site-packages/dataclasses.py", line 202
class InitVar(metaclass=_InitVarMeta):
^
SyntaxError: invalid syntax
if i train a new model.
how to reload the model in flask?
Please help me out with this error ASAP!!
This is what comes after clicking the predict button
debug
debug2
[2020-05-09 06:02:15,424] ERROR in app: Exception on /predict/ [POST]
Traceback (most recent call last):
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\flask\app.py", line 2311, in wsgi_app
response = self.full_dispatch_request()
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\flask\app.py", line 1834, in full_dispatch_request
rv = self.handle_user_exception(e)
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\flask\app.py", line 1737, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\flask_compat.py", line 36, in reraise
raise value
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\flask\app.py", line 1832, in full_dispatch_request
rv = self.dispatch_request()
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\flask\app.py", line 1818, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\hp\how_to_deploy_a_keras_model_to_production-master\app.py", line 75, in predict
out = model.predict(x)
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1113, in predict
self, x, batch_size=batch_size, verbose=verbose, steps=steps)
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\tensorflow\python\keras\engine\training_arrays.py", line 329, in model_iteration
batch_outs = f(ins_batch)
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\tensorflow\python\keras\backend.py", line 3076, in call
run_metadata=self.run_metadata)
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\tensorflow\python\client\session.py", line 1439, in call
run_metadata_ptr)
File "H:\anaconda3\envs\TejasEnv\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 528, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable dense_2/bias from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/dense_2/bias/class tensorflow::Var does not exist.
[[{{node dense_2/BiasAdd/ReadVariableOp}}]]
I am using Tensorflow 1.13.0 version
I get this error:
Traceback (most recent call last): File "C:\Users\Oussama\AppData\Local\Programs\Python\Python35\lib\site-packages\flask\app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "C:\Users\Oussama\AppData\Local\Programs\Python\Python35\lib\site-packages\flask\app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\Oussama\AppData\Local\Programs\Python\Python35\lib\site-packages\flask\app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Users\Oussama\AppData\Local\Programs\Python\Python35\lib\site-packages\flask\_compat.py", line 33, in reraise raise value File "C:\Users\Oussama\AppData\Local\Programs\Python\Python35\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\Oussama\AppData\Local\Programs\Python\Python35\lib\site-packages\flask\app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "app.py", line 56, in predict convertImage(imgData) File "app.py", line 36, in convertImage imgstr = re.search(r'base64,(.*)',imgData1).group(1) File "C:\Users\Oussama\AppData\Local\Programs\Python\Python35\lib\re.py", line 173, in search return _compile(pattern, flags).search(string) TypeError: cannot use a string pattern on a bytes-like object
invalid syntax.....
TensorFlow version in the requirements file should updated to last version otherwise some functions won't work ( like convolution )
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.