Spaces:
Runtime error
Runtime error
Commit
·
ebbf257
1
Parent(s):
b4cd868
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ from fastai.tabular.all import *
|
|
| 6 |
from fastai.vision.all import *
|
| 7 |
from fastai.vision.utils import get_image_files
|
| 8 |
from Ambrosia import pre_process_image
|
| 9 |
-
from huggingface_hub import from_pretrained_fastai, push_to_hub_fastai
|
| 10 |
import gradio as gr
|
| 11 |
# Set the token
|
| 12 |
os.environ["HUGGINGFACE_TOKEN"] = "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"
|
|
@@ -39,7 +39,11 @@ def unkown_prob_calc(probs, wedge_threshold, wedge_magnitude=1, wedge='strict'):
|
|
| 39 |
return(unknown_prob)
|
| 40 |
|
| 41 |
# load model
|
| 42 |
-
learn = from_pretrained_fastai(r"ChristopherMarais/Andrew_Alpha_model")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
# get class names
|
| 44 |
labels = np.append(np.array(learn.dls.vocab), "Unknown")
|
| 45 |
|
|
|
|
| 6 |
from fastai.vision.all import *
|
| 7 |
from fastai.vision.utils import get_image_files
|
| 8 |
from Ambrosia import pre_process_image
|
| 9 |
+
from huggingface_hub import from_pretrained_fastai, push_to_hub_fastai, hf_hub_download
|
| 10 |
import gradio as gr
|
| 11 |
# Set the token
|
| 12 |
os.environ["HUGGINGFACE_TOKEN"] = "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"
|
|
|
|
| 39 |
return(unknown_prob)
|
| 40 |
|
| 41 |
# load model
|
| 42 |
+
# learn = from_pretrained_fastai(r"ChristopherMarais/Andrew_Alpha_model")
|
| 43 |
+
learn = load_learner(
|
| 44 |
+
hf_hub_download('ChristopherMarais/Andrew_Alpha_model', filename="model.pkl")
|
| 45 |
+
)
|
| 46 |
+
|
| 47 |
# get class names
|
| 48 |
labels = np.append(np.array(learn.dls.vocab), "Unknown")
|
| 49 |
|