Spaces:
Runtime error
Runtime error
Commit
•
7b37229
1
Parent(s):
cc50161
making the predict part working back
Browse files- app.py +6 -9
- requirements.txt +3 -2
app.py
CHANGED
@@ -107,6 +107,7 @@ else:
|
|
107 |
|
108 |
params, setup = user_input_features()
|
109 |
|
|
|
110 |
st.subheader("Instructions:")
|
111 |
st.write("""
|
112 |
1. Modify the dataset by using the sliders in the Dataset group on the left on the screen.
|
@@ -135,13 +136,14 @@ else:
|
|
135 |
c1, c2, c3 = '#1e4a76', '#7dc0f7', '#ff7c0a' # colors
|
136 |
# sns.scatterplot(x=X, y=Y, color=c1)
|
137 |
# st.pyplot()
|
|
|
138 |
sns.lineplot(x=X, y=Y, color=c1)
|
139 |
sns.lineplot(x=X_pred, y=Y_pred, color=c2, linestyle=':')
|
140 |
plt.ylim(min(-2, min(Y), min(Y_pred)), max(2, max(Y), max(Y_pred)))
|
141 |
plt.legend(['Train data', 'Test data'], loc=3)
|
142 |
plt.xlabel('Sample number')
|
143 |
plt.ylabel('Sample value')
|
144 |
-
st.pyplot()
|
145 |
st.write("The plot presents generated train and test data. Use the sliders on the left to modify the curve.")
|
146 |
|
147 |
|
@@ -163,21 +165,16 @@ else:
|
|
163 |
waiters.append(st.image('wait.gif'))
|
164 |
waiters.append(st.text("""The process should take around 20-60 seconds."""))
|
165 |
|
166 |
-
|
167 |
-
myUrl = 'https://rnn-background.azurewebsites.net/api/predict?code=a/X0yioXXY4CFVd9UFTw4MiyStNJ2qh3oae7FdFN7VBFMFhqe/qK7Q=='
|
168 |
-
# request = json.dumps(setup)
|
169 |
-
result = predict_series(data, steps=66, r1_nodes=14, r2_nodes=14, fc1_nodes=20)
|
170 |
-
# _ = [waiter.empty() for waiter in waiters]
|
171 |
-
|
172 |
-
result = np.array(range(5))
|
173 |
|
|
|
174 |
sns.lineplot(x=X_pred, y=Y_pred, color=c2, linestyle=':')
|
175 |
sns.lineplot(x=X, y=Y, color=c1)
|
176 |
sns.lineplot(np.append(X[-1], np.arange(0, test_len, gran) + max(X) + gran), np.append(Y[-1], result['result']), color=c3)
|
177 |
plt.legend(['Train data', 'Test data', 'Predicted data'], loc=3)
|
178 |
plt.xlabel('Sample number')
|
179 |
plt.ylabel('Sample value')
|
180 |
-
st.pyplot()
|
181 |
|
182 |
st.write("The prediction isn't good enough? Try to change settings in the model setup or increase the dataset length.")
|
183 |
st.write('Training took {} epochs, Mean Squared Error: {:.2e}'.format(result['epochs'], result['loss']))
|
|
|
107 |
|
108 |
params, setup = user_input_features()
|
109 |
|
110 |
+
st.header("Work in progress - please be back in a few days")
|
111 |
st.subheader("Instructions:")
|
112 |
st.write("""
|
113 |
1. Modify the dataset by using the sliders in the Dataset group on the left on the screen.
|
|
|
136 |
c1, c2, c3 = '#1e4a76', '#7dc0f7', '#ff7c0a' # colors
|
137 |
# sns.scatterplot(x=X, y=Y, color=c1)
|
138 |
# st.pyplot()
|
139 |
+
fig, ax = plt.subplots()
|
140 |
sns.lineplot(x=X, y=Y, color=c1)
|
141 |
sns.lineplot(x=X_pred, y=Y_pred, color=c2, linestyle=':')
|
142 |
plt.ylim(min(-2, min(Y), min(Y_pred)), max(2, max(Y), max(Y_pred)))
|
143 |
plt.legend(['Train data', 'Test data'], loc=3)
|
144 |
plt.xlabel('Sample number')
|
145 |
plt.ylabel('Sample value')
|
146 |
+
st.pyplot(fig)
|
147 |
st.write("The plot presents generated train and test data. Use the sliders on the left to modify the curve.")
|
148 |
|
149 |
|
|
|
165 |
waiters.append(st.image('wait.gif'))
|
166 |
waiters.append(st.text("""The process should take around 20-60 seconds."""))
|
167 |
|
168 |
+
result = predict_series(**setup)
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
+
fig, ax = plt.subplots()
|
171 |
sns.lineplot(x=X_pred, y=Y_pred, color=c2, linestyle=':')
|
172 |
sns.lineplot(x=X, y=Y, color=c1)
|
173 |
sns.lineplot(np.append(X[-1], np.arange(0, test_len, gran) + max(X) + gran), np.append(Y[-1], result['result']), color=c3)
|
174 |
plt.legend(['Train data', 'Test data', 'Predicted data'], loc=3)
|
175 |
plt.xlabel('Sample number')
|
176 |
plt.ylabel('Sample value')
|
177 |
+
st.pyplot(fig)
|
178 |
|
179 |
st.write("The prediction isn't good enough? Try to change settings in the model setup or increase the dataset length.")
|
180 |
st.write('Training took {} epochs, Mean Squared Error: {:.2e}'.format(result['epochs'], result['loss']))
|
requirements.txt
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
streamlit==1.17.0
|
2 |
requests
|
3 |
-
numpy
|
4 |
seaborn
|
5 |
matplotlib
|
6 |
-
tensorflow
|
|
|
|
1 |
streamlit==1.17.0
|
2 |
requests
|
3 |
+
numpy==1.19.5
|
4 |
seaborn
|
5 |
matplotlib
|
6 |
+
tensorflow
|
7 |
+
sklearn
|