Quake24 commited on
Commit
e6d5d30
1 Parent(s): 7faaa4b

[ADD]source code

Browse files
Files changed (5) hide show
  1. app.py +19 -0
  2. davinci.jpeg +0 -0
  3. picasso.jpeg +0 -0
  4. requirements.txt +1 -0
  5. vangogh.jpeg +0 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+
4
+ categories = ('Vincent_van_Gogh', 'Leonardo_da_Vinci')
5
+ learn = load_learner('painter.pkl')
6
+
7
+
8
+ def classify_painter(img):
9
+ painter, _, probs = learn.predict(img)
10
+ return dict(zip(categories, map(float, probs)))
11
+
12
+
13
+ image = gr.inputs.Image(shape=(192, 192))
14
+ label = gr.outputs.Label()
15
+ examples = ['davinci.jpeg', 'vangogh.jpeg', 'picasso.jpeg']
16
+
17
+ iface = gr.Interface(fn=classify_painter, inputs=image,
18
+ outputs=label, examples=examples)
19
+ iface.launch(inline=False)
davinci.jpeg ADDED
picasso.jpeg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ !pip install -Uqq fastai
vangogh.jpeg ADDED