DanielV commited on
Commit
65d5ed6
1 Parent(s): c4849ec

updated app (4)

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -2,9 +2,12 @@ from fastai.vision import *
2
  from fastai.learner import load_learner
3
  from PIL import Image
4
  import gradio as gr
5
- from pathlib import Path
6
 
7
- learn = load_learner(Path("model.pkl"))
 
 
 
 
8
  categories = list(learn.dls.vocab)
9
 
10
 
@@ -17,7 +20,7 @@ image = gr.inputs.Image(shape=(192,192))
17
  # Whats the gradio output type? Label
18
  label = gr.outputs.Label()
19
  # Set up some examples
20
- examples = [Path("examples/kairi.jpg"), Path("examples/riku.jpg"), Path("examples/sora.jpg")]
21
 
22
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
23
  intf.launch(inline=False)
 
2
  from fastai.learner import load_learner
3
  from PIL import Image
4
  import gradio as gr
 
5
 
6
+ import pathlib, platform
7
+ plt = platform.system()
8
+ if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
9
+
10
+ learn = load_learner("model.pkl")
11
  categories = list(learn.dls.vocab)
12
 
13
 
 
20
  # Whats the gradio output type? Label
21
  label = gr.outputs.Label()
22
  # Set up some examples
23
+ examples = ["examples/kairi.jpg", "examples/riku.jpg", "examples/sora.jpg"]
24
 
25
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
26
  intf.launch(inline=False)