Update app.py
Browse files
app.py
CHANGED
@@ -16,19 +16,26 @@ import zipfile
|
|
16 |
# Define the filename
|
17 |
zip_filename = 'Images.zip'
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
with zipfile.ZipFile(zip_filename, 'r') as zip_ref:
|
25 |
-
zip_ref.extractall()
|
26 |
-
print(f"'{zip_filename}' has been successfully unzipped.")
|
27 |
-
else:
|
28 |
-
print(f"'{zip_filename}' not found in the current directory.")
|
29 |
|
30 |
with gr.Blocks(css="style.css") as demo:
|
31 |
def get_image_embeddings(valid_df, model_path):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
tokenizer = DistilBertTokenizer.from_pretrained(CFG.text_tokenizer)
|
33 |
valid_loader = build_loaders(valid_df, tokenizer, mode="valid")
|
34 |
|
|
|
16 |
# Define the filename
|
17 |
zip_filename = 'Images.zip'
|
18 |
|
19 |
+
import os
|
20 |
+
import zipfile
|
21 |
+
|
22 |
+
|
23 |
+
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
with gr.Blocks(css="style.css") as demo:
|
26 |
def get_image_embeddings(valid_df, model_path):
|
27 |
+
# Define the filename
|
28 |
+
zip_filename = 'Images.zip'
|
29 |
+
|
30 |
+
# Check if the file exists
|
31 |
+
if os.path.isfile(zip_filename):
|
32 |
+
# Open the zip file
|
33 |
+
with zipfile.ZipFile(zip_filename, 'r') as zip_ref:
|
34 |
+
# Extract all contents of the zip file to the current directory
|
35 |
+
zip_ref.extractall()
|
36 |
+
print(f"'{zip_filename}' has been successfully unzipped.")
|
37 |
+
else:
|
38 |
+
print(f"'{zip_filename}' not found in the current directory.")
|
39 |
tokenizer = DistilBertTokenizer.from_pretrained(CFG.text_tokenizer)
|
40 |
valid_loader = build_loaders(valid_df, tokenizer, mode="valid")
|
41 |
|