Spaces:
Runtime error
Runtime error
gorkemgoknar
commited on
Commit
•
95b3196
1
Parent(s):
e0a3048
Update app.py
Browse files
app.py
CHANGED
@@ -508,19 +508,23 @@ def get_sentence(history, chatbot_role,llm_model,system_prompt=""):
|
|
508 |
yield (sentence, history)
|
509 |
|
510 |
# return that final sentence token
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
if
|
515 |
-
|
516 |
-
|
517 |
-
|
|
|
|
|
|
|
|
|
|
|
518 |
|
519 |
-
|
520 |
-
|
521 |
-
print("
|
522 |
|
523 |
-
yield (last_sentence, history)
|
524 |
|
525 |
from scipy.io.wavfile import write
|
526 |
from pydub import AudioSegment
|
|
|
508 |
yield (sentence, history)
|
509 |
|
510 |
# return that final sentence token
|
511 |
+
try:
|
512 |
+
last_sentence = nltk.sent_tokenize(history[-1][1].replace("\n", " ").strip())[-1]
|
513 |
+
sentence_hash = hash(last_sentence)
|
514 |
+
if sentence_hash not in sentence_hash_list:
|
515 |
+
if stored_sentence is not None and stored_sentence_hash is not None:
|
516 |
+
last_sentence = stored_sentence + last_sentence
|
517 |
+
stored_sentence = stored_sentence_hash = None
|
518 |
+
print("Last Sentence with stored:",last_sentence)
|
519 |
+
|
520 |
+
sentence_hash_list.append(sentence_hash)
|
521 |
+
sentence_list.append(last_sentence)
|
522 |
+
print("Last Sentence: ", last_sentence)
|
523 |
|
524 |
+
yield (last_sentence, history)
|
525 |
+
except:
|
526 |
+
print("ERROR on last sentence history is :", history)
|
527 |
|
|
|
528 |
|
529 |
from scipy.io.wavfile import write
|
530 |
from pydub import AudioSegment
|