arpannookala commited on
Commit
e610b64
·
1 Parent(s): e9b803a

change requirements and edit app

Browse files
Files changed (2) hide show
  1. app.py +27 -19
  2. requirements.txt +3 -1
app.py CHANGED
@@ -19,25 +19,33 @@ nltk.download('omw-1.4')
19
 
20
  # --------------------------- Dynamic Download of Large Files --------------------------- #
21
  import gdown
22
-
23
- # Example for LanceDB
24
- gdown.download("https://drive.google.com/uc?id=1N7B1ycXbmEPZXRft8OTjvCxcfz92bf", "lancedb_directory_main.zip", quiet=False)
25
-
26
- # Example for the Fine-Tuned Model
27
- gdown.download("https://drive.google.com/uc?id=13ahw_99cSwlW5_U6-MrkIlB9uYy3Zwty", "finetuned_all_minilm_l6_v2.zip", quiet=False)
28
- # Download LanceDB
29
- # gdd.download_file_from_google_drive(
30
- # file_id='1N7B1ycXbmEPZXRft8OTjvCxcfz92bfku', # Replace with your actual file ID
31
- # dest_path='./lancedb_directory_main.zip',
32
- # unzip=True
33
- # )
34
-
35
- # # Download fine-tuned model
36
- # gdd.download_file_from_google_drive(
37
- # file_id='13ahw_99cSwlW5_U6-MrkIlB9uYy3Zwty', # Replace with your actual file ID
38
- # dest_path='./finetuned_all_minilm_l6_v2.zip',
39
- # unzip=True
40
- # )
 
 
 
 
 
 
 
 
41
  # # --------------------------- Load the LanceDB Table and Models --------------------------- #
42
 
43
  # Connect to LanceDB
 
19
 
20
  # --------------------------- Dynamic Download of Large Files --------------------------- #
21
  import gdown
22
+ import zipfile
23
+ import os
24
+
25
+ # Function to download and extract folder
26
+ def download_and_extract_gdrive(file_id, destination, extract_to):
27
+ # Download the zip file
28
+ gdown.download(f"https://drive.google.com/uc?id={file_id}", destination, quiet=False)
29
+
30
+ # Extract the zip file
31
+ with zipfile.ZipFile(destination, 'r') as zip_ref:
32
+ zip_ref.extractall(extract_to)
33
+ os.remove(destination) # Clean up the downloaded zip file
34
+
35
+ # Download and extract LanceDB and fine-tuned model
36
+ st.info("Downloading and setting up necessary data. This might take a while...")
37
+
38
+ download_and_extract_gdrive(
39
+ file_id="1Qnb8bs_NXWlhDwGoswOgsp2DiLBMbfSY", # Replace with the actual Google Drive file ID
40
+ destination="lancedb_directory_main.zip",
41
+ extract_to="./"
42
+ )
43
+
44
+ download_and_extract_gdrive(
45
+ file_id="1_9VVuN_P3zsTBYzg0lAeh4ghd9zhXS3w", # Replace with the actual Google Drive file ID
46
+ destination="finetuned_all_minilm_l6_v2.zip",
47
+ extract_to="./"
48
+ )
49
  # # --------------------------- Load the LanceDB Table and Models --------------------------- #
50
 
51
  # Connect to LanceDB
requirements.txt CHANGED
@@ -6,4 +6,6 @@ sentence-transformers
6
  lancedb
7
  nltk
8
  gdown
9
- transformers
 
 
 
6
  lancedb
7
  nltk
8
  gdown
9
+ transformers
10
+ zipfile
11
+ os