Commit
·
e610b64
1
Parent(s):
e9b803a
change requirements and edit app
Browse files- app.py +27 -19
- 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 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
#
|
31 |
-
|
32 |
-
|
33 |
-
#
|
34 |
-
|
35 |
-
#
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
#
|
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
|