Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,12 +18,22 @@ from keras.models import load_model
|
|
| 18 |
# Replace 'your_username' and 'your_model_name' with the appropriate values
|
| 19 |
import zipfile
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
model_identifier = "Chancee12/satellite_segmentation_v3_full"
|
| 22 |
filename = "satellite_segmentation_v3_full.zip"
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
# Extract the zip file
|
| 26 |
-
with zipfile.ZipFile(
|
| 27 |
zip_ref.extractall("satellite_segmentation_v3_full")
|
| 28 |
|
| 29 |
|
|
|
|
| 18 |
# Replace 'your_username' and 'your_model_name' with the appropriate values
|
| 19 |
import zipfile
|
| 20 |
|
| 21 |
+
from huggingface_hub import HfApi, HfFolder
|
| 22 |
+
import requests
|
| 23 |
+
|
| 24 |
+
api = HfApi()
|
| 25 |
model_identifier = "Chancee12/satellite_segmentation_v3_full"
|
| 26 |
filename = "satellite_segmentation_v3_full.zip"
|
| 27 |
+
|
| 28 |
+
# Get the URL to download the model
|
| 29 |
+
url = api.model_download_url(model_identifier, filename)
|
| 30 |
+
|
| 31 |
+
# Download the model
|
| 32 |
+
response = requests.get(url)
|
| 33 |
+
open(filename, "wb").write(response.content)
|
| 34 |
|
| 35 |
# Extract the zip file
|
| 36 |
+
with zipfile.ZipFile(filename, 'r') as zip_ref:
|
| 37 |
zip_ref.extractall("satellite_segmentation_v3_full")
|
| 38 |
|
| 39 |
|