Update app.py
Browse files
app.py
CHANGED
|
@@ -3,11 +3,22 @@ import pandas as pd
|
|
| 3 |
import gradio as gr
|
| 4 |
import tensorflow as tf
|
| 5 |
|
| 6 |
-
MODEL_PATH = "activity_model.weights.h5"
|
| 7 |
CLASS_NAMES = ["Stationary", "Walking", "Running"]
|
| 8 |
EXPECTED_STEPS = 100
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def read_signal(file_path):
|
| 13 |
if file_path is None:
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import tensorflow as tf
|
| 5 |
|
|
|
|
| 6 |
CLASS_NAMES = ["Stationary", "Walking", "Running"]
|
| 7 |
EXPECTED_STEPS = 100
|
| 8 |
|
| 9 |
+
from tensorflow.keras import Sequential
|
| 10 |
+
from tensorflow.keras.layers import Conv1D, MaxPooling1D, Flatten, Dense
|
| 11 |
+
|
| 12 |
+
MODEL_PATH = "activity_model.weights.h5"
|
| 13 |
+
|
| 14 |
+
model = Sequential([
|
| 15 |
+
Conv1D(32, kernel_size=5, activation="relu", input_shape=(100, 1)),
|
| 16 |
+
MaxPooling1D(pool_size=2),
|
| 17 |
+
Flatten(),
|
| 18 |
+
Dense(32, activation="relu"),
|
| 19 |
+
Dense(3, activation="softmax")
|
| 20 |
+
])
|
| 21 |
+
model.load_weights(MODEL_PATH)
|
| 22 |
|
| 23 |
def read_signal(file_path):
|
| 24 |
if file_path is None:
|