Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -55,8 +55,7 @@ def respond(
|
|
55 |
settings.stream = True
|
56 |
|
57 |
messages = BasicChatHistory()
|
58 |
-
|
59 |
-
|
60 |
for msn in history:
|
61 |
user = {
|
62 |
'role': Roles.user,
|
@@ -70,7 +69,7 @@ def respond(
|
|
70 |
messages.add_message(assistant)
|
71 |
|
72 |
stream = agent.get_chat_response(
|
73 |
-
message,
|
74 |
llm_sampling_settings=settings,
|
75 |
chat_history=messages,
|
76 |
returns_streaming_generator=True,
|
@@ -81,17 +80,6 @@ def respond(
|
|
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 = """
|
96 |
<div class="message-bubble-border" style="display:flex; max-width: 600px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px);">
|
97 |
<div style="padding: .5rem 1.5rem;">
|
|
|
55 |
settings.stream = True
|
56 |
|
57 |
messages = BasicChatHistory()
|
58 |
+
|
|
|
59 |
for msn in history:
|
60 |
user = {
|
61 |
'role': Roles.user,
|
|
|
69 |
messages.add_message(assistant)
|
70 |
|
71 |
stream = agent.get_chat_response(
|
72 |
+
sf.encoder(message),
|
73 |
llm_sampling_settings=settings,
|
74 |
chat_history=messages,
|
75 |
returns_streaming_generator=True,
|
|
|
80 |
for output in stream:
|
81 |
outputs += output
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
PLACEHOLDER = """
|
84 |
<div class="message-bubble-border" style="display:flex; max-width: 600px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px);">
|
85 |
<div style="padding: .5rem 1.5rem;">
|