Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,11 +52,14 @@ st.set_option("deprecation.showfileUploaderEncoding", False)
|
|
| 52 |
@st.cache_resource(show_spinner=False)
|
| 53 |
def load_model():
|
| 54 |
try:
|
| 55 |
-
from huggingface_hub import
|
|
|
|
| 56 |
|
| 57 |
# Download the model files directly
|
| 58 |
model_path = hf_hub_download(repo_id="ryefoxlime/PneumoniaDetection", filename="saved_model.pb")
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
return model
|
| 61 |
except Exception as e:
|
| 62 |
st.error(f"Error loading model: {str(e)}")
|
|
|
|
| 52 |
@st.cache_resource(show_spinner=False)
|
| 53 |
def load_model():
|
| 54 |
try:
|
| 55 |
+
from huggingface_hub import hf_hub_download
|
| 56 |
+
from keras.layers import TFSMLayer
|
| 57 |
|
| 58 |
# Download the model files directly
|
| 59 |
model_path = hf_hub_download(repo_id="ryefoxlime/PneumoniaDetection", filename="saved_model.pb")
|
| 60 |
+
|
| 61 |
+
# Use TFSMLayer to load the model
|
| 62 |
+
model = TFSMLayer(model_path, call_endpoint='serving_default')
|
| 63 |
return model
|
| 64 |
except Exception as e:
|
| 65 |
st.error(f"Error loading model: {str(e)}")
|