This API provides endpoints for stroke prediction analysis using different modalities: facial images, arm movement data, and speech audio. Each endpoint accepts specific file types and returns standardized prediction results.
https://medaistroke.duckdns.org/api
Analyzes facial images to predict stroke probability.
Endpoint: /face
Method: POST
Content-Type: multipart/form-data
| Parameter | Type | Required | Description |
|---|---|---|---|
| image | File | Yes | Image file containing a face |
{
"message": "Face analysis completed",
"result": {
"stroke": 0, // 0: No stroke, 1: Stroke
"score": 0.873 // Probability score (0-1)
}
}Analyzes arm movement data to predict stroke probability.
Endpoint: /arm
Method: POST
Content-Type: multipart/form-data
| Parameter | Type | Required | Description |
|---|---|---|---|
| csv | File | Yes | CSV file containing arm movement data |
{
"message": "Arm analysis completed",
"result": {
"stroke": 0, // 0: No stroke, 1: Stroke
"score": 0.873 // Probability score (0-1)
}
}Analyzes speech audio to predict stroke probability.
Endpoint: /speech
Method: POST
Content-Type: multipart/form-data
| Parameter | Type | Required | Description |
|---|---|---|---|
| audio | File | Yes | Audio file containing speech |
{
"message": "Speech analysis completed",
"result": {
"stroke": 0, // 0: No stroke, 1: Stroke
"score": 0.873 // Probability score (0-1)
}
}Returned when the request is invalid (e.g., missing file, invalid file format)
{
"error": "No image file"
}Returned when an unexpected error occurs during processing
{
"error": "Internal Server Error",
"message": "Error description"
}- Python 11
- Flask 3.0.3
- TensorFlow 2.17.0
- OpenCV 4.10.0
- scikit-learn 1.5.2
- Additional dependencies listed in requirements.txt
- Install the required dependencies:
pip install -r requirements.txt-
Ensure all model files are present in the configured
TRAINED_MODELS_DIR:- face_model.pkl
- arm_model.pkl
- speech_model.keras
-
Start the Flask server:
python app.py- All prediction endpoints return a standardized response format with a stroke prediction (0 or 1) and a confidence score
- In production mode, detailed error messages are suppressed for security
- Debug mode can be enabled for detailed error tracking during development