Spaces:
Sleeping
Sleeping
Commit
·
2733fb3
1
Parent(s):
ef23023
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
"""
|
3 |
-
Created on
|
4 |
|
5 |
@author: Bernd Ebenhoch
|
6 |
"""
|
7 |
|
8 |
|
|
|
9 |
import numpy as np
|
10 |
import tensorflow as tf
|
11 |
from tensorflow import keras
|
@@ -104,7 +105,8 @@ if st.button('Run the ad campaign and display the results'):
|
|
104 |
information_for_plotting[epoch, 7] = grads_adjusted[1]
|
105 |
information_for_plotting[epoch, 8] = copy.deepcopy(model.trainable_variables[0])
|
106 |
information_for_plotting[epoch, 9] = copy.deepcopy(model.trainable_variables[1])
|
107 |
-
|
|
|
108 |
titles = ['Model Output', 'Action', 'Loss', 'Gradients', 'Rewards',
|
109 |
'Adjusted Gradients', 'Model Parameters']
|
110 |
plus = [0, 0, 0, 0, 1, 1, 2]
|
@@ -130,7 +132,8 @@ if st.button('Run the ad campaign and display the results'):
|
|
130 |
plt.xlabel('Epoch')
|
131 |
plt.show()
|
132 |
|
133 |
-
|
134 |
-
|
|
|
135 |
|
136 |
st.pyplot(fig)
|
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
"""
|
3 |
+
Created on Mon May 1 07:55:45 2023
|
4 |
|
5 |
@author: Bernd Ebenhoch
|
6 |
"""
|
7 |
|
8 |
|
9 |
+
|
10 |
import numpy as np
|
11 |
import tensorflow as tf
|
12 |
from tensorflow import keras
|
|
|
105 |
information_for_plotting[epoch, 7] = grads_adjusted[1]
|
106 |
information_for_plotting[epoch, 8] = copy.deepcopy(model.trainable_variables[0])
|
107 |
information_for_plotting[epoch, 9] = copy.deepcopy(model.trainable_variables[1])
|
108 |
+
|
109 |
+
# Plot the results
|
110 |
titles = ['Model Output', 'Action', 'Loss', 'Gradients', 'Rewards',
|
111 |
'Adjusted Gradients', 'Model Parameters']
|
112 |
plus = [0, 0, 0, 0, 1, 1, 2]
|
|
|
132 |
plt.xlabel('Epoch')
|
133 |
plt.show()
|
134 |
|
135 |
+
# Sum of the total clicks obtained
|
136 |
+
st.markdown('Your ad campaign received **' +
|
137 |
+
str(int(information_for_plotting[:, 5].sum())) + '** clicks in total.')
|
138 |
|
139 |
st.pyplot(fig)
|