Spaces:
Sleeping
Sleeping
Commit ·
d8ae710
1
Parent(s): 09bf51b
new update
Browse files
app.py
CHANGED
|
@@ -4,18 +4,17 @@ import pickle
|
|
| 4 |
import numpy as np
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
import os
|
| 7 |
-
|
| 8 |
|
| 9 |
def load_model():
|
| 10 |
repo_id = 'Preethamreddy799/NLP_MODEL'
|
| 11 |
-
filename = 'model_test_steps.
|
| 12 |
|
| 13 |
-
#
|
| 14 |
cached_model_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
| 15 |
|
| 16 |
# Load the model from the cached path
|
| 17 |
-
|
| 18 |
-
model = pickle.load(file)
|
| 19 |
|
| 20 |
print(f"Model loaded successfully from {cached_model_path}")
|
| 21 |
return model
|
|
|
|
| 4 |
import numpy as np
|
| 5 |
from huggingface_hub import hf_hub_download
|
| 6 |
import os
|
| 7 |
+
from tensorflow.keras.models import load_model
|
| 8 |
|
| 9 |
def load_model():
|
| 10 |
repo_id = 'Preethamreddy799/NLP_MODEL'
|
| 11 |
+
filename = 'model_test_steps.h5' # Assuming the model is in HDF5 format
|
| 12 |
|
| 13 |
+
# Download the model from Hugging Face repository
|
| 14 |
cached_model_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
| 15 |
|
| 16 |
# Load the model from the cached path
|
| 17 |
+
model = load_model(cached_model_path)
|
|
|
|
| 18 |
|
| 19 |
print(f"Model loaded successfully from {cached_model_path}")
|
| 20 |
return model
|
test.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pickle
|
| 2 |
+
|
| 3 |
+
downloads_path = '/Users/preethamreddygollapalli/Downloads/'
|
| 4 |
+
|
| 5 |
+
# Load the saved models
|
| 6 |
+
with open(downloads_path + 'model_test_steps.pkl', 'rb') as file:
|
| 7 |
+
model = pickle.load(file)
|
| 8 |
+
print(type(model))
|
| 9 |
+
print(model)
|
| 10 |
+
|