Views
No views yet
1wifi-csi-har-lstm/
2|-- inference.py
3|-- labels.json
4|-- model_config.json
5|-- requirements.txt
6|-- simple_lstm_best.pth
7`-- upload_to_hf.pysimple_lstm_best.pthhidden2label classifier(batch, 1024, 468)(1024, 468)standingwalkingget_downsittingget_uplyingno_personpip install -r requirements.txt1from inference import get_predictor
2
3predictor = get_predictor()
4
5def classify_csi(csi_array):
6 # csi_array can be a Python list, NumPy array, or torch.Tensor.
7 # Accepted shapes: (1024, 468) or (batch, 1024, 468).
8 return predictor.predict(csi_array)1{
2 "predictions": [
3 {
4 "class_index": 0,
5 "label": "standing",
6 "confidence": 0.98,
7 "probabilities": {
8 "standing": 0.98,
9 "walking": 0.01,
10 "get_down": 0.0,
11 "sitting": 0.0,
12 "get_up": 0.0,
13 "lying": 0.0,
14 "no_person": 0.01
15 }
16 }
17 ]
18}1from fastapi import FastAPI
2from pydantic import BaseModel
3
4from inference import get_predictor
5
6app = FastAPI()
7predictor = get_predictor()
8
9
10class PredictRequest(BaseModel):
11 csi: list
12
13
14@app.post("/predict")
15def predict(request: PredictRequest):
16 return predictor.predict(request.csi)python inference.pypython inference.py --input_json sample.json