Spaces:
Sleeping
Sleeping
ricardo-lsantos
commited on
Commit
•
5bda5fb
1
Parent(s):
7c2618e
fix download button
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import streamlit as st
|
|
|
2 |
from nn import train, predict, save_model, sigmoid
|
3 |
|
4 |
# INPUTS = [[0,0],[0,1],[1,0],[1,1]]
|
@@ -12,11 +13,15 @@ OUTPUTS = [[0],[1],[1],[0]]
|
|
12 |
def runNN(epoch, alpha):
|
13 |
# Train model
|
14 |
modelo = train(epochs=epoch, alpha=alpha)
|
15 |
-
|
16 |
print(modelo)
|
17 |
# Save model to file
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
for i in range(4):
|
22 |
result = predict(INPUTS[i][0],INPUTS[i][1], activation=sigmoid)
|
|
|
1 |
import streamlit as st
|
2 |
+
import json
|
3 |
from nn import train, predict, save_model, sigmoid
|
4 |
|
5 |
# INPUTS = [[0,0],[0,1],[1,0],[1,1]]
|
|
|
13 |
def runNN(epoch, alpha):
|
14 |
# Train model
|
15 |
modelo = train(epochs=epoch, alpha=alpha)
|
|
|
16 |
print(modelo)
|
17 |
# Save model to file
|
18 |
+
# save_model(modelo, "modelo.json")
|
19 |
+
st.download_button(
|
20 |
+
label="Download model",
|
21 |
+
data=json.dumps(modelo),
|
22 |
+
file_name="modelo.json",
|
23 |
+
mime="application/json",
|
24 |
+
)
|
25 |
|
26 |
for i in range(4):
|
27 |
result = predict(INPUTS[i][0],INPUTS[i][1], activation=sigmoid)
|