Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,13 +4,14 @@ import gradio as gr
|
|
4 |
learner = load_learner("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(image)
|
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()
|
|
|
4 |
learner = load_learner("model.pkl")
|
5 |
|
6 |
with open('categories.txt', 'r') as file:
|
7 |
+
categories = file.read().split("\n")
|
8 |
|
9 |
def classify_image(image):
|
10 |
pred,idx,probs = learner.predict(image)
|
11 |
return dict(zip(categories,map(float,probs)))
|
12 |
|
13 |
ins = gr.inputs.Image()
|
14 |
+
|
15 |
outs = gr.outputs.Label()
|
16 |
interface = gr.Interface(fn=classify_image,inputs=ins,outputs=outs)
|
17 |
interface.launch()
|