Przemek Pietrzkiewicz commited on
Commit
002ab59
1 Parent(s): a7f7863

Add examples and explanation

Browse files
a2_b_m.jpg ADDED
a2_coeur_lyon.jpg ADDED
app.py CHANGED
@@ -1,16 +1,44 @@
1
  from fastai.vision.all import *
2
  import gradio as gr
3
 
 
4
  def greet(name):
5
  return "Hello " + name + "!!"
6
 
7
 
8
- learn = load_learner('model-v7.pkl')
9
 
10
  labels = learn.dls.vocab
 
 
11
  def predict(img):
12
  img = PILImage.create(img)
13
- pred,pred_idx,probs = learn.predict(img)
14
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
15
 
16
- gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
 
4
+
5
  def greet(name):
6
  return "Hello " + name + "!!"
7
 
8
 
9
+ learn = load_learner("model-v7.pkl")
10
 
11
  labels = learn.dls.vocab
12
+
13
+
14
  def predict(img):
15
  img = PILImage.create(img)
16
+ pred, pred_idx, probs = learn.predict(img)
17
  return {labels[i]: float(probs[i]) for i in range(len(labels))}
18
 
19
+
20
+ examples = [
21
+ "a2_b_m.jpg",
22
+ "a2_coeur_lyon.jpg",
23
+ "gzup_america.jpg",
24
+ "gzup_gameboy.jpg",
25
+ "pa_425.jpg",
26
+ "pa_1341.jpg",
27
+ "stork_music.jpg",
28
+ "stork_prince.jpg",
29
+ ]
30
+
31
+ DESCRIPTION = """
32
+ Street art deep learning model. It's trained to recognize the style of the following artists active in Paris:
33
+ [A2](https://a2-streetart.com/), [gzup](https://www.gzup.fr/in-the-streets/), [invader](https://www.instagram.com/invaderwashere), [stork](https://www.instagram.com/stork_pixelart/).
34
+ For more AI experiments check out my [newsletter](https://newsletter.pnote.eu) 💫.
35
+ """
36
+
37
+ gr.Interface(
38
+ fn=predict,
39
+ inputs=gr.inputs.Image(shape=(512, 512)),
40
+ outputs=gr.outputs.Label(num_top_classes=3),
41
+ examples=examples,
42
+ title="Art reco, recognizer of street art",
43
+ description=DESCRIPTION
44
+ ).launch(share=True)
gzup_america.jpg ADDED
gzup_gameboy.jpg ADDED
invaders-and-friends.ipynb CHANGED
The diff for this file is too large to render. See raw diff
 
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:630e9cc5c5ce038ccdf0a9b7a770b1eb849ab81a4a14e7102cb9a6ee06dcc54f
3
+ size 46968626
pa_1341.jpg ADDED
pa_425.jpg ADDED
stork_music.jpg ADDED
stork_prince.jpg ADDED