MSU576 commited on
Commit
bf35b88
·
verified ·
1 Parent(s): 38a4bbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -472,7 +472,10 @@ import streamlit as st
472
  @st.cache_resource
473
  def load_soil_model():
474
  try:
475
- model = torch.load("soil_best_model.pth", map_location=torch.device("cpu"))
 
 
 
476
  model.eval()
477
  return model
478
  except Exception as e:
 
472
  @st.cache_resource
473
  def load_soil_model():
474
  try:
475
+ # Define your SoilNet model architecture again
476
+ model = SoilNet() # same architecture you trained with
477
+ state_dict = torch.load("soil_best_model.pth", map_location="cpu")
478
+ model.load_state_dict(state_dict)
479
  model.eval()
480
  return model
481
  except Exception as e: