Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import numpy as np
|
|
| 2 |
import pandas as pd
|
| 3 |
import gradio as gr
|
| 4 |
import tensorflow as tf
|
|
|
|
| 5 |
|
| 6 |
CLASS_NAMES = ["Stationary", "Walking", "Running"]
|
| 7 |
EXPECTED_STEPS = 100
|
|
@@ -35,7 +36,7 @@ def read_signal(file_path):
|
|
| 35 |
if len(values) != EXPECTED_STEPS:
|
| 36 |
raise gr.Error(f"Expected exactly {EXPECTED_STEPS} sensor readings, found {len(values)}.")
|
| 37 |
return values
|
| 38 |
-
|
| 39 |
def predict_activity(file_path):
|
| 40 |
values = read_signal(file_path)
|
| 41 |
x = values.reshape(1, EXPECTED_STEPS, 1)
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import gradio as gr
|
| 4 |
import tensorflow as tf
|
| 5 |
+
import spaces
|
| 6 |
|
| 7 |
CLASS_NAMES = ["Stationary", "Walking", "Running"]
|
| 8 |
EXPECTED_STEPS = 100
|
|
|
|
| 36 |
if len(values) != EXPECTED_STEPS:
|
| 37 |
raise gr.Error(f"Expected exactly {EXPECTED_STEPS} sensor readings, found {len(values)}.")
|
| 38 |
return values
|
| 39 |
+
@spaces.GPU
|
| 40 |
def predict_activity(file_path):
|
| 41 |
values = read_signal(file_path)
|
| 42 |
x = values.reshape(1, EXPECTED_STEPS, 1)
|