Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,16 @@
|
|
1 |
import streamlit as st
|
2 |
from tensorflow import keras
|
3 |
import numpy as np
|
4 |
-
from huggingface_hub import
|
5 |
|
6 |
# Authenticate and download the custom model from Hugging Face Spaces
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
f.write(r.content)
|
12 |
|
13 |
# Load your custom model
|
14 |
-
model = keras.models.load_model(
|
15 |
|
16 |
# Define a function that takes an image as input and uses the model for inference
|
17 |
def image_classifier(image):
|
|
|
1 |
import streamlit as st
|
2 |
from tensorflow import keras
|
3 |
import numpy as np
|
4 |
+
from huggingface_hub import HfFileSystem
|
5 |
|
6 |
# Authenticate and download the custom model from Hugging Face Spaces
|
7 |
+
fs = HfFileSystem()
|
8 |
+
model_path = 'dhhd255/idk_test/best_model.h5'
|
9 |
+
with fs.open(model_path, 'rb') as f:
|
10 |
+
model_content = f.read()
|
|
|
11 |
|
12 |
# Load your custom model
|
13 |
+
model = keras.models.load_model(model_content)
|
14 |
|
15 |
# Define a function that takes an image as input and uses the model for inference
|
16 |
def image_classifier(image):
|