PhDFlo commited on
Commit
e4fb88b
·
1 Parent(s): 1c8abff
.gradio/flagged/dataset1.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ img,output,timestamp
2
+ .gradio/flagged/img/2bf96196995f897eb82f/amanite.jpg,"{""label"": null, ""confidences"": null}",2025-05-24 11:07:40.000039
.gradio/flagged/img/2bf96196995f897eb82f/amanite.jpg ADDED
app.ipynb ADDED
File without changes
app.py CHANGED
@@ -1,20 +1,18 @@
1
- from huggingface_hub import from_pretrained_fastai
2
  import gradio as gr
3
 
4
- def which_champi(x): return x[0].isupper()
5
-
6
  # Load the model
7
- learn = from_pretrained_fastai('./modelchampi.pkl')
8
 
9
  categories = ('amanite','bolet', 'morille', 'truffe')
10
 
11
  def classify_image(img):
12
- pred_idx_probs = learn.predict(img)
13
  return dict(zip(categories, map(float,probs)))
14
 
15
- image = gr.inputs.Image(shape=(192,192))
16
- label = gr.outputs.Label()
17
- examples = ['amanite.png', 'truffe.png']
18
 
19
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
20
  intf.launch(inline=False)
 
1
+ from fastai.vision.all import *
2
  import gradio as gr
3
 
 
 
4
  # Load the model
5
+ learn = load_learner('modelchampi.pkl')
6
 
7
  categories = ('amanite','bolet', 'morille', 'truffe')
8
 
9
  def classify_image(img):
10
+ pred,idx,probs = learn.predict(img)
11
  return dict(zip(categories, map(float,probs)))
12
 
13
+ image = gr.Image(height=192, width=192)
14
+ label = gr.Label()
15
+ examples = ['amanite.jpg', 'truffe.jpg']
16
 
17
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
18
  intf.launch(inline=False)