I’m having an issue when I try to use a conditional statement to display text. My code is as follows:
st.header('Expected Winnings Based on Risk Profile')
option = st.radio("What level of risk would you like to adopt?",("High","Medium","Low"))
if option == "High":
st.write("Your expected returns are: ",High_Risk_Winnings)
elif option == "Medium":
st.write("Your expected returns are: ",Medium_Risk_Winnings)
else:
st.write("Your expected returns are: ",Low_Risk_Winnings)
High / Medium / Low _Risk_Winnings are all objects from my preceding code.
Once I’ve run the code, when I click on one of the radio buttons I get the following error message: AttributeError: ‘_thread._local’ object has no attribute 'value’
I tried running your code snippet and can’t reproduce the error. But after looking at the traceback you provided and doing a little more research, I think this is a Keras issue related to version 2.3.0 of Keras.
Is that the version you’re using? If so, can you try 2.2.5 or 2.3.1?
The previously proposed solution did not satisfied me as i did not want to downgrade Keras and TF. After searching online, I found this fix, which worked for me :
I’m using keras 2.3.1, tensorflow 2.0.0, python 3.6, linux Mint 19.2 Cinnamon.
My project is based on Waitress, so I can’t use “threaded=False”.
I found an UGLY workaround…
In the main “post manager” function I put this code…
import keras.backend.tensorflow_backend as tb tb._SYMBOLIC_SCOPE.value = True
And this solved the problem for me…
I hope it will be useful to find a solution
By @ccasadei
I hope this can be a solution for others having the same problem as us.
from tensorflow.keras.applications.vgg16 import VGG16
instead of:
from keras.applications.vgg16 import VGG16
Although it was working in one folder right but not another.