Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ import os
|
|
| 9 |
# Add current directory to path for local imports
|
| 10 |
sys.path.append(os.path.abspath('.'))
|
| 11 |
|
| 12 |
-
from models.simple_nn import
|
| 13 |
from models.transformer_imdb import TransformerClassifier
|
| 14 |
|
| 15 |
# Constants
|
|
@@ -21,7 +21,8 @@ VOCAB_SIZE = 100684
|
|
| 21 |
|
| 22 |
# 1. Helper functions to load models
|
| 23 |
def load_image_model(model_type):
|
| 24 |
-
|
|
|
|
| 25 |
path = MNIST_PATH if 'MNIST' in model_type else FASHION_PATH
|
| 26 |
if os.path.exists(path):
|
| 27 |
model.load_state_dict(torch.load(path, map_location=DEVICE))
|
|
|
|
| 9 |
# Add current directory to path for local imports
|
| 10 |
sys.path.append(os.path.abspath('.'))
|
| 11 |
|
| 12 |
+
from models.simple_nn import SimpleNN
|
| 13 |
from models.transformer_imdb import TransformerClassifier
|
| 14 |
|
| 15 |
# Constants
|
|
|
|
| 21 |
|
| 22 |
# 1. Helper functions to load models
|
| 23 |
def load_image_model(model_type):
|
| 24 |
+
# Using correct class name found in file check
|
| 25 |
+
model = SimpleNN().to(DEVICE)
|
| 26 |
path = MNIST_PATH if 'MNIST' in model_type else FASHION_PATH
|
| 27 |
if os.path.exists(path):
|
| 28 |
model.load_state_dict(torch.load(path, map_location=DEVICE))
|