PyarasaniSrinivas commited on
Commit
d0729a3
·
verified ·
1 Parent(s): 895dc8a

Upload 4 files

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. app.py +26 -0
  3. image_preprocess.csv +3 -0
  4. knn_cls.pkl +3 -0
  5. requirements.txt +6 -0
.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
+ image_preprocess.csv filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+ import joblib
5
+ import cv2
6
+ from PIL import Image
7
+
8
+
9
+
10
+ model=joblib.load(r"D:\image_project\knn_cls.pkl")
11
+ st.title("Image Prediction")
12
+ image=st.file_uploader(label="upload only tomato and apple ",type='image/*')
13
+
14
+ if image is not None:
15
+ st.image(image)
16
+ # file_bytes = np.asarray(bytearray(image.read()), dtype=np.uint8)
17
+ # image = cv2.imdecode(file_bytes, cv2.IMREAD_COLOR)
18
+ image=Image.open(image)
19
+ image=np.array(image)
20
+ image=cv2.resize(src=image,dsize=(100,100),interpolation=cv2.INTER_LINEAR)
21
+ image=image.flatten()
22
+ df=pd.DataFrame(image)
23
+ df=df.T
24
+ if st.button("Predict"):
25
+ y_pred=model.predict(df)
26
+ st.info(f"The predicted value is {y_pred[0]}")
image_preprocess.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96ae366b7aa872a636c655e440d043c71cf35855d13f292c63be145858b0cf38
3
+ size 42505361
knn_cls.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ffbab577ad2b4b9b27419043c2609b4237e05acd1c0d23098e38364c982478b3
3
+ size 70552597
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ numpy
2
+ pandas
3
+ joblib
4
+ streamlit
5
+ scikit-learn
6
+ opencv-python