PanagiotaMoraiti commited on
Commit
2cf1b20
·
1 Parent(s): 72816a8

let's deploy to huggingface spaces

Browse files
Files changed (1) hide show
  1. app.py +0 -28
app.py DELETED
@@ -1,28 +0,0 @@
1
- import gradio as gr
2
- from fastai.vision.all import *
3
-
4
- learn = load_learner('model.pkl')
5
- labels = ['brown_spots', 'green', 'spoiled', 'yellow']
6
-
7
-
8
- def predict(img):
9
- img = PILImage.create(img)
10
- pred,pred_idx,probs = learn.predict(img)
11
- return {labels[i]: float(probs[i]) for i in range(len(labels))}
12
-
13
- title = "Banana Quality Classifier"
14
- description = "A banana classifier that can classify bananas into 4 categories based on their quality"
15
- examples = ['yellow_banana.jpg', 'green_banana.jpg', 'banana_with_brown_spots.jpg', 'black_banana.jpg']
16
- interpretation='default'
17
- enable_queue=True
18
-
19
- gr.Interface(
20
- fn=predict,
21
- inputs=gr.inputs.Image(shape=(512, 512)),
22
- outputs=gr.outputs.Label(num_top_classes=3),
23
- title=title,
24
- description=description,
25
- examples=examples,
26
- interpretation=interpretation,
27
- enable_queue=enable_queue
28
- ).launch()