Spaces:
Sleeping
Sleeping
Commit ·
5e562ec
1
Parent(s): 3fe49fc
fix missing model
Browse files- src/prediction.py +7 -3
src/prediction.py
CHANGED
|
@@ -2,7 +2,7 @@ import numpy as np
|
|
| 2 |
import streamlit as st
|
| 3 |
import tensorflow as tf
|
| 4 |
from PIL import Image
|
| 5 |
-
from huggingface_hub import
|
| 6 |
import os
|
| 7 |
|
| 8 |
|
|
@@ -21,8 +21,12 @@ class_names = [
|
|
| 21 |
|
| 22 |
@st.cache_resource
|
| 23 |
def load_model_from_hub():
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
return model
|
| 27 |
|
| 28 |
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
import tensorflow as tf
|
| 4 |
from PIL import Image
|
| 5 |
+
from huggingface_hub import hf_hub_download
|
| 6 |
import os
|
| 7 |
|
| 8 |
|
|
|
|
| 21 |
|
| 22 |
@st.cache_resource
|
| 23 |
def load_model_from_hub():
|
| 24 |
+
model_path = hf_hub_download(
|
| 25 |
+
repo_id="Heizsenberg/leaf_classification",
|
| 26 |
+
filename="leaf_detection_model.keras",
|
| 27 |
+
repo_type="space" # VERY IMPORTANT
|
| 28 |
+
)
|
| 29 |
+
model = tf.keras.models.load_model(model_path)
|
| 30 |
return model
|
| 31 |
|
| 32 |
|