Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,9 @@
|
|
| 1 |
-
# app.py (API FastAPI)
|
| 2 |
import os
|
| 3 |
import tempfile
|
| 4 |
from fastapi import FastAPI, UploadFile, File, HTTPException
|
| 5 |
from fastapi.responses import JSONResponse
|
| 6 |
import tensorflow as tf
|
| 7 |
-
from prediction import predict_eeg_recording
|
| 8 |
|
| 9 |
app = FastAPI(title="EEG Epilepsy Prediction API")
|
| 10 |
model = tf.keras.models.load_model('model1_2dcnn.h5')
|
|
@@ -33,3 +32,7 @@ async def predict_endpoint(file: UploadFile = File(...)):
|
|
| 33 |
"segment_probabilities": [float(p) for p in segment_probs]
|
| 34 |
}
|
| 35 |
return JSONResponse(content=response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import tempfile
|
| 3 |
from fastapi import FastAPI, UploadFile, File, HTTPException
|
| 4 |
from fastapi.responses import JSONResponse
|
| 5 |
import tensorflow as tf
|
| 6 |
+
from prediction import predict_eeg_recording
|
| 7 |
|
| 8 |
app = FastAPI(title="EEG Epilepsy Prediction API")
|
| 9 |
model = tf.keras.models.load_model('model1_2dcnn.h5')
|
|
|
|
| 32 |
"segment_probabilities": [float(p) for p in segment_probs]
|
| 33 |
}
|
| 34 |
return JSONResponse(content=response)
|
| 35 |
+
|
| 36 |
+
if __name__ == "__main__":
|
| 37 |
+
import uvicorn
|
| 38 |
+
uvicorn.run("app:app", host="0.0.0.0", port=7860, reload=True)
|