Spaces:
Running
Running
Update app.py
Browse filesfixed errors re db's with udate = unknown
app.py
CHANGED
|
@@ -97,9 +97,11 @@ def do_search(prompt, db_name, start_date, end_date):
|
|
| 97 |
dot_products = []
|
| 98 |
for (name, text, time, yt_id, udate, db_embed) in embeddings:
|
| 99 |
udate = udate.replace('"','')
|
| 100 |
-
if not 'unknown' in udate:
|
| 101 |
if int(udate) < int(start_date) or int(udate) > int(end_date):
|
| 102 |
continue
|
|
|
|
|
|
|
| 103 |
dp = dot_product(prompt_embed, db_embed)
|
| 104 |
dot_products.append((name, text, time, yt_id, udate, dp) )
|
| 105 |
sorted_dots = sorted(dot_products, key=lambda x: x[5])[-10:]
|
|
@@ -135,7 +137,7 @@ def get_db_embeddings(db_name):
|
|
| 135 |
embed = row[6]
|
| 136 |
else:
|
| 137 |
embed = row[5]
|
| 138 |
-
udate = '
|
| 139 |
x = []
|
| 140 |
row_embed = []
|
| 141 |
for i in range(1536):
|
|
@@ -371,7 +373,7 @@ def chat(prompt, user_window, pwd_window, past, response, gptModel, clip_text, d
|
|
| 371 |
clip_txt += '\nSorry, no results were within the start/end dates you specified\n'
|
| 372 |
for (name, text, time, yt_id, udate, dp) in results:
|
| 373 |
upload_date = udate.replace('"','')
|
| 374 |
-
if not
|
| 375 |
upload_date = upload_date[0:4] + '-' + upload_date[4:6] + '-' + upload_date[6:8]
|
| 376 |
yt_id = yt_id.replace('"','')
|
| 377 |
seek_HMS = seek_hms(time)
|
|
|
|
| 97 |
dot_products = []
|
| 98 |
for (name, text, time, yt_id, udate, db_embed) in embeddings:
|
| 99 |
udate = udate.replace('"','')
|
| 100 |
+
if not 'unknown' in udate.casefold():
|
| 101 |
if int(udate) < int(start_date) or int(udate) > int(end_date):
|
| 102 |
continue
|
| 103 |
+
else:
|
| 104 |
+
udate = 'Date unknown'
|
| 105 |
dp = dot_product(prompt_embed, db_embed)
|
| 106 |
dot_products.append((name, text, time, yt_id, udate, dp) )
|
| 107 |
sorted_dots = sorted(dot_products, key=lambda x: x[5])[-10:]
|
|
|
|
| 137 |
embed = row[6]
|
| 138 |
else:
|
| 139 |
embed = row[5]
|
| 140 |
+
udate = 'Date unknown'
|
| 141 |
x = []
|
| 142 |
row_embed = []
|
| 143 |
for i in range(1536):
|
|
|
|
| 373 |
clip_txt += '\nSorry, no results were within the start/end dates you specified\n'
|
| 374 |
for (name, text, time, yt_id, udate, dp) in results:
|
| 375 |
upload_date = udate.replace('"','')
|
| 376 |
+
if not 'unknown' in upload_date.casefold():
|
| 377 |
upload_date = upload_date[0:4] + '-' + upload_date[4:6] + '-' + upload_date[6:8]
|
| 378 |
yt_id = yt_id.replace('"','')
|
| 379 |
seek_HMS = seek_hms(time)
|