Spaces:
Sleeping
Sleeping
Commit ·
b9f1e89
1
Parent(s): 79cdac4
added getenv for 403
Browse files- src/prediction.py +3 -1
src/prediction.py
CHANGED
|
@@ -3,6 +3,7 @@ import streamlit as st
|
|
| 3 |
import tensorflow as tf
|
| 4 |
from PIL import Image
|
| 5 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
class_names = [
|
|
@@ -22,7 +23,8 @@ class_names = [
|
|
| 22 |
def load_model_from_hub():
|
| 23 |
model_path = hf_hub_download(
|
| 24 |
repo_id="Heizsenberg/tomato-leaf-classification",
|
| 25 |
-
filename="leaf_detection_model.keras"
|
|
|
|
| 26 |
)
|
| 27 |
model = tf.keras.models.load_model(model_path)
|
| 28 |
return model
|
|
|
|
| 3 |
import tensorflow as tf
|
| 4 |
from PIL import Image
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
+
import os
|
| 7 |
|
| 8 |
|
| 9 |
class_names = [
|
|
|
|
| 23 |
def load_model_from_hub():
|
| 24 |
model_path = hf_hub_download(
|
| 25 |
repo_id="Heizsenberg/tomato-leaf-classification",
|
| 26 |
+
filename="leaf_detection_model.keras",
|
| 27 |
+
token=os.getenv("HF_TOKEN")
|
| 28 |
)
|
| 29 |
model = tf.keras.models.load_model(model_path)
|
| 30 |
return model
|