apikeyforLLM commited on
Commit
4411082
·
verified ·
1 Parent(s): f816961

upload files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ yashwanth3(200e)_plantmodel.keras filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, jsonify
2
+ import tensorflow as tf
3
+ import numpy as np
4
+ import cv2
5
+ import base64
6
+
7
+ app = Flask(__name__)
8
+
9
+ # Load the ML model
10
+ model = tf.keras.models.load_model("model.h5")
11
+
12
+ # Function to decode base64 image
13
+ def decode_image(image_data):
14
+ image_bytes = base64.b64decode(image_data)
15
+ image_np = np.frombuffer(image_bytes, dtype=np.uint8)
16
+ image = cv2.imdecode(image_np, cv2.IMREAD_COLOR)
17
+ image = cv2.resize(image, (224, 224)) # Adjust based on your model
18
+ image = image / 255.0 # Normalize if needed
19
+ return image.reshape(1, 224, 224, 3)
20
+
21
+ # API endpoint for prediction
22
+ @app.route('/predict', methods=['POST'])
23
+ def predict():
24
+ try:
25
+ data = request.json['image']
26
+ image = decode_image(data)
27
+ prediction = model.predict(image).tolist()
28
+ return jsonify({'prediction': prediction})
29
+ except Exception as e:
30
+ return jsonify({'error': str(e)})
31
+
32
+ if __name__ == '__main__':
33
+ app.run(debug=True)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ fastapi==0.115.11
2
+ uvicorn==0.34.0
3
+ tensorflow==2.14.0
4
+ numpy==1.24.0
5
+ pillow==11.1.0
yashwanth3(200e)_plantmodel.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:730522c647f022f4144a52b524a6026fae6b7391098b671d2ce9fa02e9414b13
3
+ size 39710843