MikeTrizna commited on
Commit
16e1552
1 Parent(s): b6268ca

Added application, model, and examples

Browse files
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: Racemose Classifier
3
- emoji:
4
  colorFrom: blue
5
  colorTo: gray
6
  sdk: gradio
 
1
  ---
2
  title: Racemose Classifier
3
+ emoji: 🌸
4
  colorFrom: blue
5
  colorTo: gray
6
  sdk: gradio
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ from fastai.learner import load_learner
4
+
5
+ learn_imp = load_learner('prunus_model_res50_temp_trop_v3_fp16_22epochs.pkl')
6
+
7
+ def predict(image_np, description=None):
8
+ classes = ['neotropical racemose', 'paleotropical racemose',
9
+ 'temperate diploid', 'temperate racemose']
10
+ pred,pred_idx,probs = learn_imp.predict(image_np)
11
+ confidences = {classes[idx]: f'{prob:.04f}' for idx, prob in enumerate(probs)}
12
+ return confidences
13
+
14
+ article = """Let's include a *table* here with links to the specific samples in the examples."""
15
+
16
+ example_list = ["examples/myrtifolia_1c086296-6d1f-4218-a18a-ca2f86c295d0.jpg",
17
+ "examples/oleifolia_104f44c9-63f1-4579-93c2-54c6ddeddeda.jpg",
18
+ "examples/oocarpa_e3276fdd-ce58-40dc-bf20-8742f7634428.jpg",
19
+ "examples/pullei_e5ac59df-5b18-4c8d-a19b-02131d358855.jpg",
20
+ "examples/serotina_0060a57d-e779-4984-913c-95b576daf0d3.jpg",
21
+ "examples/grayana_b9fa9ff9-2e8b-42f5-8728-5b0b5be98490.jpg",
22
+ "examples/glandulosa_52e06de9-c035-4afc-9fac-c8bee7628d38.jpg",
23
+ "examples/pensylvanica_0b13e5eb-73da-4e0e-9b1a-794b737f7716.jpg"]
24
+
25
+ demo = gr.Interface(predict,
26
+ gr.Image(type="numpy"),
27
+ outputs="label",
28
+ examples=example_list,
29
+ description="Upload a digitized herbarium sheet, or choose one of the examples below",
30
+ title="Image Classification of Diploid or Racemose Plants",
31
+ article=article)
32
+
33
+ demo.launch()
examples/glandulosa_52e06de9-c035-4afc-9fac-c8bee7628d38.jpg ADDED
examples/grayana_b9fa9ff9-2e8b-42f5-8728-5b0b5be98490.jpg ADDED
examples/myrtifolia_1c086296-6d1f-4218-a18a-ca2f86c295d0.jpg ADDED
examples/oleifolia_104f44c9-63f1-4579-93c2-54c6ddeddeda.jpg ADDED
examples/oocarpa_e3276fdd-ce58-40dc-bf20-8742f7634428.jpg ADDED
examples/pensylvanica_0b13e5eb-73da-4e0e-9b1a-794b737f7716.jpg ADDED
examples/pullei_e5ac59df-5b18-4c8d-a19b-02131d358855.jpg ADDED
examples/serotina_0060a57d-e779-4984-913c-95b576daf0d3.jpg ADDED
prunus_model_res50_temp_trop_v3_fp16_22epochs.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:847d82d18d70b6e5b22812e075e7edc01d5a1de9ef1051ff6ed6178664d63fef
3
+ size 103001173
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai