Pudding commited on
Commit
508aa9b
1 Parent(s): 1325f34
Files changed (6) hide show
  1. .vscode/launch.json +16 -0
  2. anime.jpeg +0 -0
  3. app.py +15 -4
  4. dunno.jpg +0 -0
  5. model.pkl +3 -0
  6. real.jpg +0 -0
.vscode/launch.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Python: Current File",
9
+ "type": "python",
10
+ "request": "launch",
11
+ "program": "${file}",
12
+ "console": "integratedTerminal",
13
+ "justMyCode": true
14
+ }
15
+ ]
16
+ }
anime.jpeg ADDED
app.py CHANGED
@@ -1,7 +1,18 @@
 
1
  import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
 
 
4
 
5
+ learn = load_learner('model.pkl')
6
+
7
+ categories = ('Anime', 'Real')
8
+
9
+ def classify_image(img):
10
+ pred,idx,probs = learn.predict(img)
11
+ return dict(zip(categories, map(float,probs)))
12
+
13
+ inputs = gr.inputs.Image(shape=(192,192))
14
+ outputs = gr.outputs.Label()
15
+ examples = ['/content/anime.jpeg','/content/real.jpg','/content/dunno.jpg']
16
+
17
+ intf = gr.Interface(fn=classify_image, inputs="image", outputs="label",examples=examples)
18
+ intf.launch(inline=False,share=True)
dunno.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e660c1870d871bdf5e25c01bea5162c12fa5fa5d83a953dff8a889c8ca4985b9
3
+ size 46960847
real.jpg ADDED