forked from MiteshJain8/learnix
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
22 lines (17 loc) · 552 Bytes
/
app.py
File metadata and controls
22 lines (17 loc) · 552 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1' # Disable GPU
from flask import Flask, request, jsonify
import pickle
import numpy as np
app = Flask(__name__)
# Load the trained model
with open('app/deaf-dumb/model.pkl', 'rb') as f:
model = pickle.load(f)
@app.route('/api/predict', methods=['POST'])
def predict():
data = request.json
features = np.array(data['features']).reshape(1, -1)
prediction = model.predict(features)[0]
return jsonify({'prediction': prediction})
if __name__ == '__main__':
app.run(debug=True)