ibrim commited on
Commit
df02a37
·
verified ·
1 Parent(s): 636cb49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -16,19 +16,26 @@ import zipfile
16
  # Define the filename
17
  zip_filename = 'Images.zip'
18
 
19
- # Check if the zip file exists in the current directory
20
- if os.path.isfile(zip_filename):
21
- print(f"'{zip_filename}' found. Unzipping...")
22
-
23
- # Unzip the file
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