Update app.py
Browse fileschanged relative path
app.py
CHANGED
|
@@ -16,7 +16,7 @@ from model.model import ResNet50
|
|
| 16 |
@st.cache_data
|
| 17 |
def load_class_names():
|
| 18 |
try:
|
| 19 |
-
with open("
|
| 20 |
# Read the file content first
|
| 21 |
content = f.read()
|
| 22 |
# Try to clean the content of any control characters
|
|
@@ -39,7 +39,7 @@ def load_class_names():
|
|
| 39 |
def load_model():
|
| 40 |
try:
|
| 41 |
model = ResNet50(num_classes=1000)
|
| 42 |
-
checkpoint = torch.load("
|
| 43 |
# Extract just the model state dict from the checkpoint
|
| 44 |
if "model_state_dict" in checkpoint:
|
| 45 |
model.load_state_dict(checkpoint["model_state_dict"])
|
|
|
|
| 16 |
@st.cache_data
|
| 17 |
def load_class_names():
|
| 18 |
try:
|
| 19 |
+
with open("imagenet_classes.json", 'r', encoding='utf-8') as f:
|
| 20 |
# Read the file content first
|
| 21 |
content = f.read()
|
| 22 |
# Try to clean the content of any control characters
|
|
|
|
| 39 |
def load_model():
|
| 40 |
try:
|
| 41 |
model = ResNet50(num_classes=1000)
|
| 42 |
+
checkpoint = torch.load("checkpoints\model_best.pth", map_location=torch.device("cpu"))
|
| 43 |
# Extract just the model state dict from the checkpoint
|
| 44 |
if "model_state_dict" in checkpoint:
|
| 45 |
model.load_state_dict(checkpoint["model_state_dict"])
|