myers commited on
Commit
baf7a19
1 Parent(s): 465fe52

initial commit

Browse files
Files changed (4) hide show
  1. .pre-commit-config.yaml +5 -0
  2. app.py +33 -0
  3. model.pkl +3 -0
  4. requirements.txt +0 -0
.pre-commit-config.yaml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/psf/black
3
+ rev: 23.3.0
4
+ hooks:
5
+ - id: black
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.vision.all import *
3
+ import skimage
4
+
5
+ learn = load_learner("model.pkl")
6
+
7
+ labels = learn.dls.vocab
8
+
9
+
10
+ def predict(img):
11
+ img = PILImage.create(img)
12
+ pred, pred_idx, probs = learn.predict(img)
13
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
14
+
15
+
16
+ title = "Hotdog or Not?"
17
+ description = "upload a picture of a hotdog or hamburger and be amazed!"
18
+ article = "<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
19
+ examples = ["siamese.jpg"]
20
+ interpretation = "default"
21
+ enable_queue = True
22
+
23
+ gr.Interface(
24
+ fn=predict,
25
+ inputs=gr.inputs.Image(shape=(512, 512)),
26
+ outputs=gr.outputs.Label(num_top_classes=3),
27
+ title=title,
28
+ description=description,
29
+ article=article,
30
+ examples=examples,
31
+ interpretation=interpretation,
32
+ enable_queue=enable_queue,
33
+ ).launch()
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff10bf6d7eaf4c56f0d4e9640cc32af39d46d6c8fe627e020366b48926ec3653
3
+ size 47058513
requirements.txt ADDED
File without changes