HeenaPatel commited on
Commit
835a845
·
1 Parent(s): 841e8ca

Add application file

Browse files
Files changed (5) hide show
  1. app.py +16 -4
  2. gradio_app.py → app2.py +0 -0
  3. dog.jpg +0 -0
  4. flagged/log.csv +2 -0
  5. model.pkl +3 -0
app.py CHANGED
@@ -1,7 +1,19 @@
 
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
+ def is_cat(x): return x[0].isupper()
5
+ im = PILImage.create('/dog.jpg')
6
+ im.thumbnail((192,192))
7
+ learn =load_learner('/model.pkl')
8
+ categories = ('dog','cat')
9
 
10
+ def classify_image(img):
11
+ pred,idx,probs = learn.predict(img)
12
+ return dict(zip(categories,map(float,probs)))
13
+
14
+ #gradio interface
15
+ image = gr.inputs.Image(shape=(192,192))
16
+ label=gr.outputs.Label()
17
+ examples=['dog.jpg','cat.jpg','dunno.jpg']
18
+ intf=gr.Interface(fn=classify_image,inputs=image,outputs=label,example=examples)
19
+ intf.launch(inline=False)
gradio_app.py → app2.py RENAMED
File without changes
dog.jpg ADDED
flagged/log.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ name,output,flag,username,timestamp
2
+ Heena,Hello Heena!!,,,2022-11-18 11:07:16.642888
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d7e1d7d021324b0226a212571dbc917e00338d152821e3514f991002065886c2
3
+ size 47065195