Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -97,6 +97,7 @@ def generate_qna_html(qna_list):
|
|
97 |
html_code += "</div>"
|
98 |
return html_code
|
99 |
|
|
|
100 |
def get_qna(input_passage):
|
101 |
"""
|
102 |
Generate question from input text
|
@@ -201,7 +202,7 @@ def save_data_to_database(qlist, input_passage):
|
|
201 |
for qa in qlist:
|
202 |
try:
|
203 |
result = dataset_mng.search(qa.get("question"), "train", "question", top_n=10)
|
204 |
-
gr.Info(f"Question already exists in db : {qa.get(
|
205 |
except:
|
206 |
if qa.get("question").lower() in already_added:
|
207 |
continue
|
@@ -211,9 +212,9 @@ def save_data_to_database(qlist, input_passage):
|
|
211 |
{
|
212 |
"question" : qa.get("question"),
|
213 |
"answer" : qa.get("answer"),
|
214 |
-
"refrence" : input_passage
|
215 |
-
|
216 |
-
|
217 |
}
|
218 |
)
|
219 |
continue
|
@@ -229,9 +230,9 @@ def save_data_to_database(qlist, input_passage):
|
|
229 |
{
|
230 |
"question" : qa.get("question"),
|
231 |
"answer" : qa.get("answer"),
|
232 |
-
"refrence" : input_passage
|
233 |
-
|
234 |
-
|
235 |
}
|
236 |
)
|
237 |
if len(to_save) < 1:
|
|
|
97 |
html_code += "</div>"
|
98 |
return html_code
|
99 |
|
100 |
+
@spaces.GPU()
|
101 |
def get_qna(input_passage):
|
102 |
"""
|
103 |
Generate question from input text
|
|
|
202 |
for qa in qlist:
|
203 |
try:
|
204 |
result = dataset_mng.search(qa.get("question"), "train", "question", top_n=10)
|
205 |
+
gr.Info(f"Question already exists in db : {qa.get('question')}")
|
206 |
except:
|
207 |
if qa.get("question").lower() in already_added:
|
208 |
continue
|
|
|
212 |
{
|
213 |
"question" : qa.get("question"),
|
214 |
"answer" : qa.get("answer"),
|
215 |
+
"refrence" : input_passage,
|
216 |
+
"data" : str(current_date_time.strftime("%d:%m:%Y %H:%M:%S")),
|
217 |
+
"timestamp" : int(time.time())
|
218 |
}
|
219 |
)
|
220 |
continue
|
|
|
230 |
{
|
231 |
"question" : qa.get("question"),
|
232 |
"answer" : qa.get("answer"),
|
233 |
+
"refrence" : input_passage,
|
234 |
+
"data" : str(current_date_time.strftime("%d:%m:%Y %H:%M:%S")),
|
235 |
+
"timestamp" : int(time.time())
|
236 |
}
|
237 |
)
|
238 |
if len(to_save) < 1:
|