Spaces:
Sleeping
Sleeping
okeowo1014
commited on
Commit
•
77e83a3
1
Parent(s):
794b9fa
Update train.py
Browse files
train.py
CHANGED
@@ -3,7 +3,9 @@ import tensorflow as tf
|
|
3 |
from tensorflow.keras.preprocessing.image import ImageDataGenerator
|
4 |
from tensorflow.keras.applications import VGG16
|
5 |
from tensorflow.keras.layers import Flatten, Dense
|
6 |
-
from huggingface_hub import push_to_hub
|
|
|
|
|
7 |
|
8 |
# Environment variable for Hugging Face token
|
9 |
sac = os.getenv('accesstoken')
|
@@ -88,7 +90,7 @@ export_dir = 'saved_model' # Create a directory for the SavedModel
|
|
88 |
tf.saved_model.save(model, export_dir)
|
89 |
|
90 |
# Upload the model to your Hugging Face space repository
|
91 |
-
push_to_hub(
|
92 |
model_path=export_dir, # Point to the SavedModel directory
|
93 |
repo_id="okeowo1014/catsanddogs",
|
94 |
commit_message="cats and dog image classifier with transfer learning",
|
|
|
3 |
from tensorflow.keras.preprocessing.image import ImageDataGenerator
|
4 |
from tensorflow.keras.applications import VGG16
|
5 |
from tensorflow.keras.layers import Flatten, Dense
|
6 |
+
# from huggingface_hub import push_to_hub
|
7 |
+
from huggingface_hub import HfApi
|
8 |
+
api = HfApi()
|
9 |
|
10 |
# Environment variable for Hugging Face token
|
11 |
sac = os.getenv('accesstoken')
|
|
|
90 |
tf.saved_model.save(model, export_dir)
|
91 |
|
92 |
# Upload the model to your Hugging Face space repository
|
93 |
+
api.push_to_hub(
|
94 |
model_path=export_dir, # Point to the SavedModel directory
|
95 |
repo_id="okeowo1014/catsanddogs",
|
96 |
commit_message="cats and dog image classifier with transfer learning",
|