0

I am currently working on a project using DJANGO KERAS and TENSORFLOW But I am really facing some issues while executing the project I even reinstalled DJANGO KERAS and TENSORFLOW but I still face these issues I have also added the screenshots of the error message Please help me to solve the issue

    Traceback (most recent call last):
  File "C:\Users\SARAVANAN\Envs\test8\lib\site-packages\django\core\handlers\exception.py", line 47, in inner
    response = get_response(request)
  File "C:\Users\SARAVANAN\Envs\test8\lib\site-packages\django\core\handlers\base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "D:\projects\final\final\views.py", line 72, in home
    result=deafult_call(call,cuisines,highlights,establishment,locality,Home_delivery,int(start),int(end),int(cost))
  File "D:\projects\final\final\views.py", line 147, in deafult_call
    with keras.backend.get_session().graph.as_default():
  File "C:\Users\SARAVANAN\Envs\test8\lib\site-packages\keras\backend\tensorflow_backend.py", line 171, in get_session
    default_session = tf.get_default_session()
  AttributeError: module 'tensorflow' has no attribute 'get_default_session'
AKX
  • 152,115
  • 15
  • 115
  • 172
  • The version of Keras you are using does not support TensorFlow 2.x, see the duplicate answer for solutions. – Dr. Snoopy Mar 24 '21 at 11:52

1 Answers1

0

tf.get_default_session() is a Tensorflow 1.x API.

You probably have a version of Keras installed that requires Tensorflow 1.x, and have Tensorflow 2.x installed alongside it.

You'll probably want to try to downgrade Tensorflow to a pre-2.0 version – if you're using Pip, pip install 'tensorflow<2.0' might do the trick for you.

Make sure you have a properly versioned requirements file (or another method of making sure you can recreate environments with the correct versions of libraries).

AKX
  • 152,115
  • 15
  • 115
  • 172