Spaces:
Runtime error
Runtime error
Daryl Fung
commited on
Commit
•
fb74953
1
Parent(s):
d8c037d
added flush for delete
Browse files- db/make_audio.py +3 -1
db/make_audio.py
CHANGED
@@ -17,7 +17,7 @@ response = Collection("Response")
|
|
17 |
audio_response = Collection("AudioResponse")
|
18 |
|
19 |
def check_if_exist(text):
|
20 |
-
return len(audio_response.query(expr=f"text == {text}")) != 0
|
21 |
|
22 |
|
23 |
async def make_audio():
|
@@ -42,6 +42,7 @@ async def make_audio():
|
|
42 |
# remove the response to generate the audio for if it already exists in the audio database
|
43 |
if check_if_exist(text):
|
44 |
response.delete(expr=f"id in {str([res[0]['id']])}")
|
|
|
45 |
continue
|
46 |
|
47 |
# generate audio
|
@@ -66,6 +67,7 @@ async def make_audio():
|
|
66 |
|
67 |
# delete text to generate audio
|
68 |
response.delete(expr=f"id in {str(ids_to_delete)}")
|
|
|
69 |
ids_to_delete = []
|
70 |
|
71 |
response_iterator.close()
|
|
|
17 |
audio_response = Collection("AudioResponse")
|
18 |
|
19 |
def check_if_exist(text):
|
20 |
+
return len(audio_response.query(expr=f"text == \"{text}\"")) != 0
|
21 |
|
22 |
|
23 |
async def make_audio():
|
|
|
42 |
# remove the response to generate the audio for if it already exists in the audio database
|
43 |
if check_if_exist(text):
|
44 |
response.delete(expr=f"id in {str([res[0]['id']])}")
|
45 |
+
response.flush()
|
46 |
continue
|
47 |
|
48 |
# generate audio
|
|
|
67 |
|
68 |
# delete text to generate audio
|
69 |
response.delete(expr=f"id in {str(ids_to_delete)}")
|
70 |
+
response.flush()
|
71 |
ids_to_delete = []
|
72 |
|
73 |
response_iterator.close()
|