Spaces:
Runtime error
Runtime error
Commit
·
d91b12e
1
Parent(s):
3af45a2
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,22 @@
|
|
| 1 |
-
import numpy as np
|
| 2 |
-
import base64
|
| 3 |
import cv2
|
| 4 |
-
from fastai.vision.all import *
|
| 5 |
import streamlit as st
|
|
|
|
| 6 |
st.markdown('<h1 style="color:black;">BDI Image classification model</h1>', unsafe_allow_html=True)
|
| 7 |
|
|
|
|
| 8 |
@st.cache(allow_output_mutation=True)
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
-
learn = load_learner('export (5).pkl')
|
| 16 |
|
| 17 |
-
categories = ('Dog Destroying Stuff','Neutral')
|
| 18 |
-
upload = st.file_uploader('Insert image for classification', type=['png','jpg'])
|
| 19 |
-
c1, c2 = st.columns(2)
|
| 20 |
-
if upload is not None:
|
| 21 |
-
im= Image.open(upload)
|
| 22 |
c1.header('Input Image')
|
| 23 |
c1.image(im)
|
| 24 |
pred, idx, probs = learn.predict(im)
|
|
|
|
| 25 |
c2.header('Output')
|
| 26 |
c2.subheader('Predicted class :')
|
| 27 |
-
c2.write(pred)
|
|
|
|
|
|
|
|
|
|
| 1 |
import cv2
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
+
from fastai.vision.all import *
|
| 4 |
st.markdown('<h1 style="color:black;">BDI Image classification model</h1>', unsafe_allow_html=True)
|
| 5 |
|
| 6 |
+
|
| 7 |
@st.cache(allow_output_mutation=True)
|
| 8 |
+
upload= st.file_uploader('Insert image for classification', type=['png','jpg'])
|
| 9 |
+
c1, c2= st.columns(2)
|
| 10 |
+
if upload is not None:
|
| 11 |
+
im= Image.open(upload))
|
| 12 |
+
|
| 13 |
|
| 14 |
|
|
|
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
c1.header('Input Image')
|
| 17 |
c1.image(im)
|
| 18 |
pred, idx, probs = learn.predict(im)
|
| 19 |
+
|
| 20 |
c2.header('Output')
|
| 21 |
c2.subheader('Predicted class :')
|
| 22 |
+
c2.write(pred)
|