Spaces:
Runtime error
Runtime error
davidlee1102
commited on
Commit
•
25d6b2b
1
Parent(s):
86de3ff
Add model
Browse files- .gitattributes +1 -0
- app.py +6 -7
- model/kd_model/fingerprint.pb +3 -0
- model/kd_model/keras_metadata.pb +3 -0
- model/kd_model/saved_model.pb +3 -0
- model/kd_model/variables/variables.index +0 -0
.gitattributes
CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*.data-00000-of-00001 filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -12,7 +12,7 @@ uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png
|
|
12 |
|
13 |
|
14 |
# Load your TensorFlow model
|
15 |
-
|
16 |
|
17 |
|
18 |
def preprocess_image(image, target_size=(224, 224)):
|
@@ -24,18 +24,17 @@ def preprocess_image(image, target_size=(224, 224)):
|
|
24 |
col1, col2 = st.columns(2)
|
25 |
|
26 |
if uploaded_file is not None:
|
27 |
-
image = Image.open(uploaded_file)
|
28 |
col1.image(image, caption="Uploaded Image", use_column_width=True)
|
29 |
|
30 |
if st.button("Classify"):
|
31 |
preprocessed_image = preprocess_image(image)
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
# predicted_class = class_labels[top_prediction]
|
37 |
|
38 |
-
col2.write(f"Predicted class:
|
39 |
else:
|
40 |
col1.write("Upload an image to see the classification")
|
41 |
col2.write("Prediction will appear here")
|
|
|
12 |
|
13 |
|
14 |
# Load your TensorFlow model
|
15 |
+
model = tf.keras.models.load_model("model/kd_model")
|
16 |
|
17 |
|
18 |
def preprocess_image(image, target_size=(224, 224)):
|
|
|
24 |
col1, col2 = st.columns(2)
|
25 |
|
26 |
if uploaded_file is not None:
|
27 |
+
image = Image.open(uploaded_file).convert('RGB')
|
28 |
col1.image(image, caption="Uploaded Image", use_column_width=True)
|
29 |
|
30 |
if st.button("Classify"):
|
31 |
preprocessed_image = preprocess_image(image)
|
32 |
+
predictions = model.predict(preprocessed_image)
|
33 |
+
top_prediction = np.argmax(predictions[0])
|
34 |
|
35 |
+
predicted_class = LABELS[top_prediction]
|
|
|
36 |
|
37 |
+
col2.write(f"Predicted class: {predicted_class}")
|
38 |
else:
|
39 |
col1.write("Upload an image to see the classification")
|
40 |
col2.write("Prediction will appear here")
|
model/kd_model/fingerprint.pb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:690937eedceddf7e2a78dee2089ec5f6a349d38376e98d8d04ba16160f640b70
|
3 |
+
size 56
|
model/kd_model/keras_metadata.pb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8bfa0da94b6ee8b5f2b48ac1b84b18dfc63125d9b407b6962ce0b73b5c3d9f7a
|
3 |
+
size 39768
|
model/kd_model/saved_model.pb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c06da34fdfeb3d6ba8b93f3ce94e7bc563b37a89bf161f99093fea9fce949587
|
3 |
+
size 379191
|
model/kd_model/variables/variables.index
ADDED
Binary file (2.41 kB). View file
|
|