Manu commited on
Commit
b06662f
·
1 Parent(s): cfd89ff

scripts to download models from the repository

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. download-h5-model.py +17 -0
  3. download-keras-model.py +17 -0
.gitignore CHANGED
@@ -1,2 +1,3 @@
1
  /saved_model
2
  .env
 
 
1
  /saved_model
2
  .env
3
+ /downloaded_models
download-h5-model.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import os
3
+ from icecream import ic
4
+
5
+ # URL del modelo
6
+ url = "https://huggingface.co/manufy/mnist_model_keras/blob/main/keras/mnist_model.keras"
7
+
8
+ # Crear la carpeta 'models' si no existe
9
+ if not os.path.exists('downloaded_models'):
10
+ os.makedirs('downloaded_models')
11
+
12
+ # Descargar el archivo del modelo
13
+ ic("Descargando modelo...")
14
+ r = requests.get(url, allow_redirects=True)
15
+ open('downloaded_models/mnist_model.h5', 'wb').write(r.content)
16
+
17
+ ic("Modelo descargado con éxito")
download-keras-model.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import os
3
+ from icecream import ic
4
+
5
+ # URL del modelo
6
+ url = "https://huggingface.co/manufy/mnist_model_keras/blob/main/keras/mnist_model.keras"
7
+
8
+ # Crear la carpeta 'models' si no existe
9
+ if not os.path.exists('downloaded_models'):
10
+ os.makedirs('downloaded_models')
11
+
12
+ # Descargar el archivo del modelo
13
+ ic("Descargando modelo...")
14
+ r = requests.get(url, allow_redirects=True)
15
+ open('downloaded_models/mnist_model.keras', 'wb').write(r.content)
16
+
17
+ ic("Modelo descargado con éxito")