Spaces:
Sleeping
Sleeping
Pradeep Kumar
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -2,21 +2,22 @@ import zipfile
|
|
2 |
import sys
|
3 |
import os
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
#
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
#
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
20 |
|
21 |
# Check current directory and list files
|
22 |
print("Current Directory:", os.getcwd())
|
|
|
2 |
import sys
|
3 |
import os
|
4 |
|
5 |
+
|
6 |
+
def unzip_file(zip_path, extract_to=None):
|
7 |
+
# Check if extract_to is provided, otherwise extract in the current directory
|
8 |
+
if extract_to is None:
|
9 |
+
extract_to = os.path.dirname(zip_path) # Extract in the same directory as the zip file
|
10 |
+
|
11 |
+
# Open the zip file
|
12 |
+
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
13 |
+
# Extract all the contents into the extract_to directory
|
14 |
+
zip_ref.extractall(extract_to)
|
15 |
+
print(f"Extracted all files to {extract_to}")
|
16 |
+
|
17 |
+
|
18 |
+
zip_file_path = 'models.zip' # Replace with your zip file path
|
19 |
+
unzip_file(zip_file_path) # This will extract to the same directory as the zip file
|
20 |
+
|
21 |
|
22 |
# Check current directory and list files
|
23 |
print("Current Directory:", os.getcwd())
|