roni commited on
Commit
28dedab
·
1 Parent(s): 3ee182f

gradio upgrade

Browse files
Files changed (4) hide show
  1. .gitignore +3 -0
  2. README.md +1 -1
  3. app.py +9 -7
  4. requirements.txt +4 -1
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ venv
2
+ .env
3
+ .idea
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🍕
4
  colorFrom: pink
5
  colorTo: green
6
  sdk: gradio
7
- sdk_version: 3.19.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: pink
5
  colorTo: green
6
  sdk: gradio
7
+ sdk_version: 4.37.1
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py CHANGED
@@ -1,20 +1,22 @@
1
  import gradio as gr
2
  from seefood_classifier_import import get_seefood_classifier
3
- import PIL.Image
4
- import numpy as np
5
 
6
  classifier = get_seefood_classifier()
7
 
 
8
  def classify(image):
9
  im = PIL.Image.fromarray(np.array(image, dtype=np.uint8))
10
  preds = classifier.predict_image(im)
11
- results = {pred['label']: pred['confidence'] for pred in preds}
12
  return results
13
 
 
14
  iface = gr.Interface(
15
- fn=classify,
16
- inputs="image",
17
  outputs="label",
18
- description="Upload your favourite food pic"
19
  )
20
- iface.launch()
 
1
  import gradio as gr
2
  from seefood_classifier_import import get_seefood_classifier
3
+ import PIL.Image
4
+ import numpy as np
5
 
6
  classifier = get_seefood_classifier()
7
 
8
+
9
  def classify(image):
10
  im = PIL.Image.fromarray(np.array(image, dtype=np.uint8))
11
  preds = classifier.predict_image(im)
12
+ results = {pred["label"]: pred["confidence"] for pred in preds}
13
  return results
14
 
15
+
16
  iface = gr.Interface(
17
+ fn=classify,
18
+ inputs="image",
19
  outputs="label",
20
+ description="Upload your favourite food pic",
21
  )
22
+ iface.launch()
requirements.txt CHANGED
@@ -1 +1,4 @@
1
- torchvision==0.13
 
 
 
 
1
+ torchvision==0.13
2
+ numpy==1.26.4
3
+ pillow
4
+ gradio