cotel557 commited on
Commit
4dfc07d
1 Parent(s): c095f5f

Add all files

Browse files
Files changed (3) hide show
  1. angry-banana.jpg +0 -0
  2. app.py +29 -0
  3. requirements.txt +2 -0
angry-banana.jpg ADDED
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+
4
+ learn = load_learner('export.pkl')
5
+
6
+ labels = learn.dls.vocab
7
+ def predict(img_fnm):
8
+ img = PILImage.create(img_fnm)
9
+ pred, pred_idx, probs = learn.predict(img)
10
+ return {label: float(prob) for label, prob in zip(labels, probs)}
11
+
12
+ title = "Moody-nana Classifier"
13
+ description = "Classifies an image as either happy, angry, or banana."
14
+ examples = ["angry-banana.jpg"]
15
+ interpretation = "default"
16
+ enable_queue = True
17
+
18
+ intf = gr.Interface(
19
+ fn=predict,
20
+ inputs=gr.inputs.Image(shape=(512, 512)),
21
+ outputs=gr.outputs.Label(num_top_classes=3),
22
+ title=title,
23
+ description=description,
24
+ examples=examples,
25
+ interpretation=interpretation,
26
+ enable_queue=enable_queue
27
+ )
28
+
29
+ intf.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastai
2
+ scikit-image