File size: 2,863 Bytes
523086c
cba7086
523086c
 
 
 
 
 
 
 
cba7086
 
9248464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6f6646e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
---
title: Manufacturing Downtime Prediction API
emoji: πŸ“‰
colorFrom: green
colorTo: red
sdk: docker
pinned: false
license: apache-2.0
---

# Manufacturing Downtime Prediction

## Project Links: 
* **[Deployed FastAPI](https://omdena-jakarta-traffic-system.streamlit.app/)**
* **[Detailed Kaggle Notebook](https://www.kaggle.com/code/sudhanshu2198/machine-defect-prediction)**

## Background
- The Manufacturing Downtime Dataset contains information about the operational parameters of various machines and their downtime records.
- Analyze machine performance, predict potential failures, and develop predictive maintenance strategies based on operational parameters.
- Features
  - Torque(Nm)
  - Hydraulic_Pressure(bar)
  - Cutting(kN)
  - Coolant_Pressure(bar)
  - Spindle_Speed(RPM)
  - Coolant_Temperature
- Target
  - Downtime

## Directory Tree
```bash

β”œβ”€β”€ app
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ modelling.py
β”‚   └──  inference.py
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ Manufacturing_Downtime_Dataset.csv
└── .gitignore
```

## Run Webapp Locally

Clone the project

```bash
  git clone https://github.com/sudhanshu2198/Manufacturing-Downtime-Prediction-API
```

Change to project directory

```bash
  cd Manufacturing-Downtime-Prediction-API
```
Create Virtaul Environment and install dependencies

```bash
  python3 -m venv venv
  source venv/bin/activate
  pip install -r requirements.txt
```

Run Locally
```bash

  uvicorn app.main:app

  ```



cURL Commands
1) Upload
```bash

Request
curl -X 'POST' \
  'http://127.0.0.1:8000/upload/' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'uploaded_file=@Manufacturing_Downtime_Dataset.csv;type=text/csv'

Response
{
  "file": "Manufacturing_Downtime_Dataset.csv",
  "content": "text/csv",
  "path": "dataset.csv"
}

```
2) Train
```bash
Request
curl -X 'POST' \
  'http://127.0.0.1:8000/train/' \
  -H 'accept: application/json' \
  -d ''
Response
  {
  "Accuracy": 0.9897750511247444,
  "F1_Score": 0.9896049896049895
  }
```
3) Predict
```bash
Request 1
curl -X 'POST' \
  'http://127.0.0.1:8000/predict/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "Torque": 28.38124,
  "Hydraulic_Pressure": 131.265854,
  "Cutting": 2.01,
  "Coolant_Pressure": 4.982836,
  "Spindle_Speed": 20033.0,
  "Coolant_Temperature": 20.1
}'

Response 1
{
  "Downtime": "No",
  "Confidence": 0.87
}

Request 2
curl -X 'POST' \
  'http://127.0.0.1:8000/predict/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "Torque": 25.614444,
  "Hydraulic_Pressure": 98.7,
  "Cutting": 3.49,
  "Coolant_Pressure": 6.839413,
  "Spindle_Speed": 18638.0,
  "Coolant_Temperature": 24.4
}'

Response 2
{
  "Downtime": "Yes",
  "Confidence": 0.98
}
```