Skip to content

mahdimhz/surrogate-shm-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

surrogate-shm-api

Author: Mahdi Mohammadzadeh

A FastAPI service that wraps the trained XGBoost surrogate model from surrogate-shm-model and serves structural response predictions over HTTP.

Given six beam geometry and material parameters, the API returns predicted tip deflection, max bending stress, and first natural frequency in under 10ms.

What it predicts

The surrogate was trained on 10,000 samples generated from Euler-Bernoulli beam theory. It accepts the following inputs:

Parameter Symbol Unit
Beam length L m
Cross-section width b m
Cross-section height h m
Young's modulus E Pa
Applied load F N
Density rho kg/m³

And returns:

Response Symbol Unit
Tip deflection delta m
Max bending stress sigma Pa
First natural frequency f1 Hz

Run with Docker

docker build -t surrogate-shm-api .
docker run -p 8000:8000 surrogate-shm-api

API docs available at http://localhost:8000/docs

Run without Docker

pip install -r requirements.txt
uvicorn app.main:app --reload

Example request

curl -X POST http://localhost:8000/predict \
  -H "Content-Type: application/json" \
  -d '{
    "L": 1.5,
    "b": 0.05,
    "h": 0.04,
    "E": 200000000000,
    "F": 5000,
    "rho": 7850
  }'

Example response

{
  "tip_deflection_m": 0.002341,
  "max_bending_stress_Pa": 175781250.0,
  "natural_frequency_Hz": 13.47
}

Endpoints

Method Path Description
GET /health Returns service status
POST /predict Runs surrogate prediction

Stack

Python, FastAPI, XGBoost, scikit-learn, Docker

Related

surrogate-shm-model rul-prediction-api

About

FastAPI and Docker service that serves XGBoost surrogate predictions for cantilever beam structural responses

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors