segadeds commited on
Commit
31eff9b
1 Parent(s): 9ae4650

Upload 9 files

Browse files
app.py CHANGED
@@ -1,7 +1,35 @@
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
+
8
+
9
+ categories = (['abraham_grampa_simpson', 'agnes_skinner', 'apu_nahasapeemapetilon', 'barney_gumble', 'bart_simpson',
10
+ 'carl_carlson', 'charles_montgomery_burns', 'chief_wiggum', 'cletus_spuckler', 'comic_book_guy', 'disco_stu',
11
+ 'edna_krabappel', 'fat_tony', 'gil', 'groundskeeper_willie', 'homer_simpson', 'kent_brockman', 'krusty_the_clown',
12
+ 'lenny_leonard', 'lionel_hutz', 'lisa_simpson', 'maggie_simpson', 'marge_simpson', 'martin_prince', 'mayor_quimby',
13
+ 'milhouse_van_houten', 'miss_hoover', 'moe_szyslak', 'ned_flanders', 'nelson_muntz', 'otto_mann', 'patty_bouvier',
14
+ 'principal_skinner', 'professor_john_frink', 'rainier_wolfcastle', 'ralph_wiggum', 'selma_bouvier', 'sideshow_bob',
15
+ 'sideshow_mel', 'snake_jailbird', 'troy_mcclure', 'waylon_smithers'])
16
+
17
+
18
+
19
+ def classify_image(img):
20
+ pred,idx,probs = learn.predict(img)
21
+ return dict(zip(categories, map(float,probs)))
22
+
23
+
24
+
25
+ image = gr.inputs.Image(shape=(192,192))
26
+ label = gr.outputs.Label()
27
+ examples = ['ednar.jpg', 'maggie.jpg', 'bart.jpg']
28
+
29
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
30
+ intf.launch(inline=False)
31
+
32
+
33
+
34
+
35
+
bart.jpg ADDED
bart.jpgZone.Identifier ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ [ZoneTransfer]
2
+ ZoneId=3
3
+ ReferrerUrl=https://www.bing.com/
4
+ HostUrl=https://images.complex.com/complex/image/upload/c_limit,dpr_auto,q_90,w_720/fl_lossy,pg_1/bart_opt_wodqc5.jpg
ednar.jpg ADDED
ednar.jpgZone.Identifier ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ [ZoneTransfer]
2
+ ZoneId=3
3
+ ReferrerUrl=https://www.bing.com/
4
+ HostUrl=https://www.bing.com/
maggie.jpg ADDED
maggie.jpgZone.Identifier ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ [ZoneTransfer]
2
+ ZoneId=3
3
+ ReferrerUrl=https://www.bing.com/
4
+ HostUrl=https://th.bing.com/th/id/OIP.oChm7qTslXgG2Bu92_Y0ogHaEJ?w=303&h=180&c=7&r=0&o=5&dpr=1.5&pid=1.7
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7da878764b38f4ef328833188e0947c6957ffcf426caa80038a20ec80804a20f
3
+ size 88159151
model.pklZone.Identifier ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [ZoneTransfer]
2
+ ZoneId=3
3
+ HostUrl=https://www.kaggle.com/