Fix the path name typo for the model location
Browse files- app.py +3 -1
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
def predict(img):
|
|
@@ -8,7 +9,8 @@ def predict(img):
|
|
| 8 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 9 |
|
| 10 |
|
| 11 |
-
|
|
|
|
| 12 |
labels = learn_inf.dls.vocab
|
| 13 |
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(224, 224)),
|
| 14 |
outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
|
|
|
| 1 |
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
|
| 6 |
def predict(img):
|
|
|
|
| 9 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 10 |
|
| 11 |
|
| 12 |
+
script_dir = os.path.dirname(os.path.realpath(__file__))
|
| 13 |
+
learn_inf = load_learner(script_dir+'/model/cat_dog_classifier.pkl')
|
| 14 |
labels = learn_inf.dls.vocab
|
| 15 |
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(224, 224)),
|
| 16 |
outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
requirements.txt
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
fastai
|
|
|
|
|
|
| 1 |
fastai
|
| 2 |
+
gradio
|