Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -55,6 +55,7 @@ def respond(
|
|
55 |
settings.stream = True
|
56 |
|
57 |
messages = BasicChatHistory()
|
|
|
58 |
|
59 |
for msn in history:
|
60 |
user = {
|
@@ -79,7 +80,16 @@ def respond(
|
|
79 |
outputs = ""
|
80 |
for output in stream:
|
81 |
outputs += output
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
|
84 |
|
85 |
PLACEHOLDER = """
|
|
|
55 |
settings.stream = True
|
56 |
|
57 |
messages = BasicChatHistory()
|
58 |
+
messages = sf.encoder(messages)
|
59 |
|
60 |
for msn in history:
|
61 |
user = {
|
|
|
80 |
outputs = ""
|
81 |
for output in stream:
|
82 |
outputs += output
|
83 |
+
|
84 |
+
if "[/INST]" in outputs and "[/IN" in outputs:
|
85 |
+
start_index = outputs.find("[/INST]") + len("[/INST]")
|
86 |
+
end_index = outputs.find("[/IN", start_index)
|
87 |
+
extracted_string = outputs[start_index:end_index].strip()
|
88 |
+
|
89 |
+
# Decode the extracted string using sf.decoder
|
90 |
+
decoded_string = sf.decoder(extracted_string)
|
91 |
+
|
92 |
+
yield decoded_string
|
93 |
|
94 |
|
95 |
PLACEHOLDER = """
|