@@ -32,9 +32,9 @@ def buttons(self):
32
32
class DocQA_Logic :
33
33
def __init__ (self , gui : DocQA_GUI ):
34
34
self .gui = gui
35
- self .embed_model_name = "" # Store the selected embedding model name
35
+ self .embed_model_name = ""
36
36
37
- # Connect the buttons to their respective actions
37
+ # Connecting the GUI buttons to their logic
38
38
self .gui .download_embedding_model_button .config (command = self .download_embedding_model )
39
39
self .gui .select_embedding_model_button .config (command = self .select_embedding_model_directory )
40
40
self .gui .choose_documents_button .config (command = self .choose_documents )
@@ -48,27 +48,27 @@ def download_embedding_model(self):
48
48
49
49
# Opening the dialog window
50
50
dialog = DownloadModelDialog (self .gui .root )
51
- selected_model = dialog .model_var .get () # this gets the selected model's name
51
+ selected_model = dialog .model_var .get ()
52
52
53
53
if selected_model :
54
54
# Construct the URL for the Hugging Face model repository
55
55
model_url = f"https://huggingface.co/{ selected_model } "
56
56
57
- # Define the target directory for the download
57
+ # Define the directory to download the model to
58
58
target_directory = os .path .join ("Embedding_Models" , selected_model .replace ("/" , "--" ))
59
59
60
- # Clone the repository using the subprocess module
60
+ # Clone the repository to the directory
61
61
subprocess .run (["git" , "clone" , model_url , target_directory ])
62
62
63
63
def select_embedding_model_directory (self ):
64
64
initial_dir = 'Embedding_Models' if os .path .exists ('Embedding_Models' ) else os .path .expanduser ("~" )
65
65
chosen_directory = filedialog .askdirectory (initialdir = initial_dir , title = "Select Embedding Model Directory" )
66
66
67
- # Store the chosen directory locally
67
+ # Choose the model directory to use
68
68
if chosen_directory :
69
69
self .embedding_model_directory = chosen_directory
70
70
71
- # Also update the global variable in server_connector.py
71
+ # Update the global variable in server_connector.py
72
72
server_connector .EMBEDDING_MODEL_NAME = chosen_directory
73
73
74
74
# Optionally, you can print or display a confirmation to the user
@@ -85,13 +85,12 @@ def choose_documents(self):
85
85
86
86
for file_path in file_paths :
87
87
shutil .copy (file_path , docs_folder )
88
- # Add any additional logic to handle the selected files
89
88
90
89
def create_chromadb (self ):
91
90
current_dir = os .path .dirname (os .path .realpath (__file__ ))
92
91
vector_db_folder = os .path .join (current_dir , "Vector_DB" )
93
92
94
- # Check if the "Vector_DB" folder exists, and create it if not
93
+ # Create the "Vector_DB" folder if it doesn't exist
95
94
if not os .path .exists (vector_db_folder ):
96
95
os .mkdir (vector_db_folder )
97
96
0 commit comments