myers commited on
Commit
687a724
β€’
1 Parent(s): b0f6c38

running it locally is a good first step

Browse files
Files changed (6) hide show
  1. README.md +9 -3
  2. app.py +9 -10
  3. hotdog.jpg +0 -0
  4. model.pkl β†’ hotdog.pkl +2 -2
  5. poetry.lock +0 -0
  6. pyproject.toml +17 -0
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Hotdog Or Not
3
- emoji: 🐨
4
  colorFrom: purple
5
  colorTo: yellow
6
  sdk: gradio
@@ -10,4 +10,10 @@ pinned: false
10
  license: apache-2.0
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
1
  ---
2
+ title: Hotdog or Not
3
+ emoji: 🌭
4
  colorFrom: purple
5
  colorTo: yellow
6
  sdk: gradio
10
  license: apache-2.0
11
  ---
12
 
13
+ Check out the configuration reference at <https://huggingface.co/docs/hub/spaces-config-reference>
14
+
15
+ ## Run locally
16
+
17
+ ```
18
+ poetry run ./app.py
19
+ ```
app.py CHANGED
@@ -1,8 +1,10 @@
 
 
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
 
@@ -14,20 +16,17 @@ def predict(img):
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()
1
+ #!/usr/bin/env python3
2
+
3
  import gradio as gr
4
  from fastai.vision.all import *
5
  import skimage
6
 
7
+ learn = load_learner("hotdog.pkl")
8
 
9
  labels = learn.dls.vocab
10
 
16
 
17
 
18
  title = "Hotdog or Not?"
19
+ description = "Upload a picture of a hotdog or hamburger and be amazed!"
20
+ examples = ["hotdog.jpg"]
 
21
  interpretation = "default"
22
  enable_queue = True
23
 
24
  gr.Interface(
25
  fn=predict,
26
+ inputs=gr.components.Image(shape=(512, 512)),
27
+ outputs=gr.components.Label(num_top_classes=3),
28
  title=title,
29
  description=description,
30
+ # examples=examples,
 
31
  interpretation=interpretation,
32
+ ).launch(enable_queue=enable_queue)
 
hotdog.jpg ADDED
model.pkl β†’ hotdog.pkl RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ff10bf6d7eaf4c56f0d4e9640cc32af39d46d6c8fe627e020366b48926ec3653
3
- size 47058513
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7fdf86706b83a7124b708e9c09c7743c7942a655503242985b362bc43f87cf6d
3
+ size 46952996
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
pyproject.toml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "hotdog-or-not"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["Myers Carpenter <myers@maski.org>"]
6
+ readme = "README.md"
7
+ packages = [{include = "hotdog_or_not"}]
8
+
9
+ [tool.poetry.dependencies]
10
+ python = "^3.8"
11
+ fastai = "^2.7.12"
12
+ scikit-image = "^0.20.0"
13
+ gradio = "^3.28.1"
14
+
15
+ [build-system]
16
+ requires = ["poetry-core"]
17
+ build-backend = "poetry.core.masonry.api"