Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,13 +4,14 @@ import time
|
|
| 4 |
|
| 5 |
from tensorflow import keras
|
| 6 |
from tensorflow.keras import layers
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
# Model / data parameters
|
| 10 |
num_classes = 9
|
| 11 |
input_shape = (28, 28, 3)
|
| 12 |
batch_size = 1000
|
| 13 |
-
epochs =
|
| 14 |
|
| 15 |
# Define baseline model
|
| 16 |
def baseline_model():
|
|
@@ -73,8 +74,6 @@ history = model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, vali
|
|
| 73 |
fin = time.time()
|
| 74 |
print(fin-inicio)
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
print("Test loss:", score[0])
|
| 80 |
-
print("Test accuracy:", score[1])
|
|
|
|
| 4 |
|
| 5 |
from tensorflow import keras
|
| 6 |
from tensorflow.keras import layers
|
| 7 |
+
app = FastAPI()
|
| 8 |
|
| 9 |
|
| 10 |
# Model / data parameters
|
| 11 |
num_classes = 9
|
| 12 |
input_shape = (28, 28, 3)
|
| 13 |
batch_size = 1000
|
| 14 |
+
epochs = 1
|
| 15 |
|
| 16 |
# Define baseline model
|
| 17 |
def baseline_model():
|
|
|
|
| 74 |
fin = time.time()
|
| 75 |
print(fin-inicio)
|
| 76 |
|
| 77 |
+
@app.get("/generate")
|
| 78 |
+
def generate(x: np.array):
|
| 79 |
+
print(model.predict(x))
|
|
|
|
|
|