AItool commited on
Commit
78cf1fb
1 Parent(s): 0c74d5c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -6,19 +6,13 @@ pathlib.PosixPath = pathlib.WindowsPath
6
  from fastai.vision.all import *
7
  import gradio as gr
8
  import pickle
 
9
 
10
- with open('./model.pkl', 'rb') as f:
11
- model = pickle.load(f)
12
 
13
- if [ ! -f /etc/apt/sources.list ]; then
14
- echo "Creating /etc/apt/sources.list"
15
- echo "deb http://deb.debian.org/debian buster main" > /etc/apt/sources.list
16
- echo "deb-src http://deb.debian.org/debian buster main" >> /etc/apt/sources.list
17
- echo "deb http://security.debian.org/debian-security buster/updates main" >> /etc/apt/sources.list
18
- echo "deb-src http://security.debian.org/debian-security buster/updates main" >> /etc/apt/sources.list
19
- echo "deb http://deb.debian.org/debian buster-updates main" >> /etc/apt/sources.list
20
- echo "deb-src http://deb.debian.org/debian buster-updates main" >> /etc/apt/sources.list
21
- fi
22
 
23
  def is_real(x): return x[0].isupper()
24
 
@@ -35,8 +29,7 @@ def classify_image(img):
35
  #*** We have to cast to float above because KAGGLE does not return number on the answer it returns tensors, and Gradio does not deal with numpy so we have to cast to float
36
 
37
  #|export
38
- #import gradio as gr
39
- import gradio as gr
40
  image = gr.inputs.Image(shape=(192,192))
41
  label = gr.outputs.Label()
42
  examples = ['virtual.jpg','real.jpg','dunno.jpg']
 
6
  from fastai.vision.all import *
7
  import gradio as gr
8
  import pickle
9
+ import timm
10
 
11
+ # Cell
12
+ learn = load_learner('model.pkl')
13
 
14
+ # Cell
15
+ #categories = learn.dls.vocab
 
 
 
 
 
 
 
16
 
17
  def is_real(x): return x[0].isupper()
18
 
 
29
  #*** We have to cast to float above because KAGGLE does not return number on the answer it returns tensors, and Gradio does not deal with numpy so we have to cast to float
30
 
31
  #|export
32
+
 
33
  image = gr.inputs.Image(shape=(192,192))
34
  label = gr.outputs.Label()
35
  examples = ['virtual.jpg','real.jpg','dunno.jpg']