Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,2 +1,16 @@
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
+
|
4 |
+
learner = load_leaner("model.pkl")
|
5 |
+
|
6 |
+
with open('categories.txt', 'r') as file:
|
7 |
+
categories = file.read().split()
|
8 |
+
|
9 |
+
def classify_image(image):
|
10 |
+
pred,idx,probs = learner.predict()
|
11 |
+
return dict(zip(categories,map(float,probs)))
|
12 |
+
|
13 |
+
ins = gr.inputs.Image()
|
14 |
+
outs = gr.outputs.Label()
|
15 |
+
interface = gr.Interface(fn=classify_image,inputs=ins,outputs=outs)
|
16 |
+
interface.launch()
|