GalaxyTab commited on
Commit
6178dfb
·
1 Parent(s): 93faa9e

Trying a different approach

Browse files
chat_application/datasetHandler.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import upload_folder
2
+ from huggingface_hub import HfApi
3
+ from huggingface_hub import login
4
+ import os
5
+
6
+ class datasetHandler():
7
+
8
+ def __init__(self,hf_token,mongoDB_name):
9
+ login(hf_token)
10
+ self.api = HfApi(token = hf_token)
11
+ self.DB_name = mongoDB_name
12
+
13
+ def make_dump(self):
14
+ try:
15
+ os.system(f"mongodump --db {self.DB_name} --out {/tmp/mongoDBContents}")
16
+ return 0
17
+ except Exception as e:
18
+ print(e)
19
+ return 1
20
+
21
+ def upload_dump(self):
22
+ try:
23
+ upload_folder(folder_path="/tmp/mongoDbContents",path_in_repo="mongoDump", repo_id="ProjectFrozone/MongoDBDumps", repo_type="dataset")
24
+ return 0
25
+ except Exception as e:
26
+ print(e)
27
+ return 1
chat_application/main.py CHANGED
@@ -22,6 +22,7 @@ from humanizing import humanize
22
  from quote_removal import remove_quotes
23
  from weird_char_removal import remove_weird_characters
24
  from duplicate_detection import duplicate_check
 
25
 
26
  #controls
27
  CHAT_CONTEXT = 20 #how many messages from chat history to append to inference prompt
 
22
  from quote_removal import remove_quotes
23
  from weird_char_removal import remove_weird_characters
24
  from duplicate_detection import duplicate_check
25
+ from datasetHandler import datasetHandler
26
 
27
  #controls
28
  CHAT_CONTEXT = 20 #how many messages from chat history to append to inference prompt