Spaces:
Runtime error
Runtime error
James Gadoury commited on
Commit ·
5b1ecf5
1
Parent(s): 9780642
Feature: Implement sink classifier
Browse filesThese changes implement a dirty or
clean sink classifier.
- app.py +17 -2
- dirty_or_clean_classifier.pkl +3 -0
app.py
CHANGED
|
@@ -1,6 +1,21 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
-
x = st.slider("Select a value")
|
| 4 |
-
st.write(x, f"The squared value is {x ** 2}")
|
| 5 |
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
|
|
|
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
+
dirty_or_clean_classifier = load_learner("dirty_or_clean_classifier.pkl")
|
| 7 |
+
|
| 8 |
+
st.title("Clean sink? Or dirty sink?")
|
| 9 |
+
|
| 10 |
+
file_name = st.file_uploader("Upload a picture of a sink")
|
| 11 |
+
|
| 12 |
+
if file_name is not None:
|
| 13 |
+
col1, col2 = st.columns(2)
|
| 14 |
+
|
| 15 |
+
image = Image.open(file_name)
|
| 16 |
+
col1.image(image, use_column_width=True)
|
| 17 |
+
|
| 18 |
+
classification, class_idx, prediction_probs = dirty_or_clean_classifier.predict(PILImage.create(file_name))
|
| 19 |
+
|
| 20 |
+
col2.header("Classification")
|
| 21 |
+
col2.subheader({"dirty_sink" : "Dirty sink", "clean_sink" : "Clean Sink"}[classification])
|
dirty_or_clean_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a7701a191cbbc4946236d8d535f681c4adecd53764686b987546b94c56b9e5a8
|
| 3 |
+
size 46961813
|