abcdef12356 commited on
Commit
d91b12e
·
1 Parent(s): 3af45a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -14
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
- def get_base64_of_bin_file(bin_file):
10
- with open(bin_file, 'rb') as f:
11
- data = f.read()
12
- return base64.b64encode(data).decode()
 
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)