jaymojnidar commited on
Commit
6eda6a3
1 Parent(s): ddee142

initial check in

Browse files
Files changed (5) hide show
  1. README.md +2 -12
  2. app.py +21 -0
  3. bias_demo.pkl +3 -0
  4. cat.jpg +0 -0
  5. requirements.txt +5 -0
README.md CHANGED
@@ -1,12 +1,2 @@
1
- ---
2
- title: Demobias
3
- emoji: 🐠
4
- colorFrom: blue
5
- colorTo: red
6
- sdk: gradio
7
- sdk_version: 4.1.1
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # fast_cassifiers
2
+ Demoing a classifier to predict an uploaded image is a car or a fish or a dog or a cat or even a tree, just in case when dementia hits me, if I forget to identify them. Help yourself if you would like.
 
 
 
 
 
 
 
 
 
 
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner('bias_demo.pkl')
6
+
7
+ labels = learn.dls.vocab
8
+ def predict(img):
9
+ img = PILImage.create(img)
10
+ pred,pred_idx,probs = learn.predict(img)
11
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
+
13
+ title = "Demo Bias"
14
+ description = "An app to demonstrate incorporating bias into AI. Created as a demo for Gradio and HuggingFace Spaces."
15
+ article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
16
+ examples = ['cat.jpg']
17
+ interpretation='default'
18
+ enable_queue=True
19
+
20
+ gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch(share=True)
21
+
bias_demo.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb27009816fee8264815625c585c72fd47b3a681a0ad41694b931b675d6b175f
3
+ size 46986381
cat.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ voila
2
+ fastai>=2
3
+ pillow<7
4
+ packaging
5
+ ipywidgets==7.5.1