Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,50 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
# # import os
|
| 3 |
-
# # import zipfile
|
| 4 |
-
# # from huggingface_hub import hf_hub_url, cached_download
|
| 5 |
-
# # import gdown
|
| 6 |
-
# # # Specify the Google Drive link to the archive file
|
| 7 |
-
# # archive_url = 'https://drive.google.com/uc?id=14QhofCbby053kWbVeWEBHCxOROQS-bjN'
|
| 8 |
-
# # # Specify the destination directory within the Hugging Face space
|
| 9 |
-
# # # Download the archive
|
| 10 |
-
# # output_path = 'SaviAnna/PicturesText'
|
| 11 |
-
# # #destination_dir = 'SaviAnna/PicturesText' # Replace with your desired destination directory
|
| 12 |
-
# # os.makedirs(output_path,exist_ok=True)
|
| 13 |
-
# # # Construct the destination path
|
| 14 |
-
# # #destination_path = hf_hub_url(destination_dir)
|
| 15 |
-
# # # Download the archive to the destination path
|
| 16 |
-
# # # cached_download(archive_url, output_path, quiet=False)
|
| 17 |
-
# # gdown.download(archive_url, output_path, quiet=False)
|
| 18 |
-
# # extracted_directory = 'PicturesText/find_pic'
|
| 19 |
-
# # # Extract the archive
|
| 20 |
-
# # with zipfile.ZipFile(output_path, 'r') as zip_ref:
|
| 21 |
-
# # zip_ref.extractall(extracted_directory)
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
# import os
|
| 25 |
-
# import zipfile
|
| 26 |
-
# import gdown
|
| 27 |
-
|
| 28 |
-
# # Specify the Google Drive link to the archive file
|
| 29 |
-
# archive_url = 'https://drive.google.com/uc?id=14QhofCbby053kWbVeWEBHCxOROQS-bjN'
|
| 30 |
-
|
| 31 |
-
# # Specify the destination directory within the Hugging Face space
|
| 32 |
-
# destination_dir = 'SaviAnna/PicturesText' # Replace with your desired destination directory
|
| 33 |
-
# os.makedirs(destination_dir, exist_ok=True)
|
| 34 |
-
|
| 35 |
-
# # Specify the output file path for the downloaded archive
|
| 36 |
-
# output_path = os.path.join(destination_dir, 'archive.zip')
|
| 37 |
-
|
| 38 |
-
# # Download the archive
|
| 39 |
-
# gdown.download(archive_url, output_path, quiet=False)
|
| 40 |
-
|
| 41 |
-
# # Specify the directory to extract the archive into
|
| 42 |
-
# extracted_directory = os.path.join(destination_dir, 'find_pic')
|
| 43 |
-
|
| 44 |
-
# # Extract the archive
|
| 45 |
-
# with zipfile.ZipFile(destination_dir, 'r') as zip_ref:
|
| 46 |
-
# zip_ref.extractall(extracted_directory)
|
| 47 |
-
|
| 48 |
import os
|
| 49 |
import zipfile
|
| 50 |
from huggingface_hub import cached_download
|
|
@@ -63,7 +16,7 @@ os.makedirs(destination_dir, exist_ok=True)
|
|
| 63 |
#archive_file = hf_hub_download(url=archive_url, destination=destination_dir)
|
| 64 |
# Extract the archive
|
| 65 |
archive_file = os.path.join(destination_dir, 'archive.zip')
|
| 66 |
-
cached_download(archive_file)
|
| 67 |
extracted_directory = os.path.join(destination_dir, 'find_pic')
|
| 68 |
|
| 69 |
with zipfile.ZipFile(archive_file, 'r') as zip_ref:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import zipfile
|
| 3 |
from huggingface_hub import cached_download
|
|
|
|
| 16 |
#archive_file = hf_hub_download(url=archive_url, destination=destination_dir)
|
| 17 |
# Extract the archive
|
| 18 |
archive_file = os.path.join(destination_dir, 'archive.zip')
|
| 19 |
+
cached_download(archive_url, archive_file)
|
| 20 |
extracted_directory = os.path.join(destination_dir, 'find_pic')
|
| 21 |
|
| 22 |
with zipfile.ZipFile(archive_file, 'r') as zip_ref:
|