Spaces:
Sleeping
Sleeping
=
commited on
Commit
·
96c8541
1
Parent(s):
7a9f5f6
adding new modification for max len
Browse files
pages/provide_sentences_mongo.py
CHANGED
@@ -99,9 +99,9 @@ def add_new_sentences():
|
|
99 |
sentences, deleted = db_manager.load_data_frames()
|
100 |
|
101 |
# add the last position to delete and modify
|
102 |
-
st.session_state.line1 =
|
103 |
|
104 |
-
st.session_state.line2 =
|
105 |
|
106 |
# let us create a callback which permit us to add sentences inside a DataFrame
|
107 |
def add_new_sentences2():
|
@@ -132,9 +132,9 @@ def add_new_sentences2():
|
|
132 |
st.session_state.right_sentence = ''
|
133 |
|
134 |
# add the last position to delete and modify
|
135 |
-
st.session_state.line1 =
|
136 |
|
137 |
-
st.session_state.line2 =
|
138 |
|
139 |
def delete_line():
|
140 |
|
|
|
99 |
sentences, deleted = db_manager.load_data_frames()
|
100 |
|
101 |
# add the last position to delete and modify
|
102 |
+
st.session_state.line1 = db_manager.get_max_id()
|
103 |
|
104 |
+
st.session_state.line2 = db_manager.get_max_id()
|
105 |
|
106 |
# let us create a callback which permit us to add sentences inside a DataFrame
|
107 |
def add_new_sentences2():
|
|
|
132 |
st.session_state.right_sentence = ''
|
133 |
|
134 |
# add the last position to delete and modify
|
135 |
+
st.session_state.line1 = db_manager.get_max_id()
|
136 |
|
137 |
+
st.session_state.line2 = db_manager.get_max_id()
|
138 |
|
139 |
def delete_line():
|
140 |
|
send_and_retrieve_data.ipynb
CHANGED
@@ -658,7 +658,7 @@
|
|
658 |
},
|
659 |
{
|
660 |
"cell_type": "code",
|
661 |
-
"execution_count":
|
662 |
"metadata": {},
|
663 |
"outputs": [
|
664 |
{
|
@@ -762,7 +762,7 @@
|
|
762 |
" \n",
|
763 |
" return results\n",
|
764 |
" \n",
|
765 |
-
" def get_max_id(self, collection):\n",
|
766 |
" \n",
|
767 |
" # recuperate the maximum id\n",
|
768 |
" id = list(self.db[collection].find().sort('_id', -1).limit(1))[0]['_id']\n",
|
|
|
658 |
},
|
659 |
{
|
660 |
"cell_type": "code",
|
661 |
+
"execution_count": 5,
|
662 |
"metadata": {},
|
663 |
"outputs": [
|
664 |
{
|
|
|
762 |
" \n",
|
763 |
" return results\n",
|
764 |
" \n",
|
765 |
+
" def get_max_id(self, collection: str = \"sentences\"):\n",
|
766 |
" \n",
|
767 |
" # recuperate the maximum id\n",
|
768 |
" id = list(self.db[collection].find().sort('_id', -1).limit(1))[0]['_id']\n",
|
wolof_translate/__pycache__/__init__.cpython-310.pyc
CHANGED
Binary files a/wolof_translate/__pycache__/__init__.cpython-310.pyc and b/wolof_translate/__pycache__/__init__.cpython-310.pyc differ
|
|
wolof_translate/utils/database_manager.py
CHANGED
@@ -89,7 +89,7 @@ class TranslationMongoDBManager:
|
|
89 |
|
90 |
return results
|
91 |
|
92 |
-
def get_max_id(self, collection):
|
93 |
|
94 |
# recuperate the maximum id
|
95 |
id = list(self.db[collection].find().sort('_id', -1).limit(1))[0]['_id']
|
|
|
89 |
|
90 |
return results
|
91 |
|
92 |
+
def get_max_id(self, collection: str = "sentences"):
|
93 |
|
94 |
# recuperate the maximum id
|
95 |
id = list(self.db[collection].find().sort('_id', -1).limit(1))[0]['_id']
|