Spaces:
Runtime error
Runtime error
contenteaseAI
commited on
Commit
•
9217d6f
1
Parent(s):
280ec8b
Added stream response
Browse files
app.py
CHANGED
@@ -136,17 +136,32 @@ def respond(message, history, temperature, max_tokens):
|
|
136 |
end_time = time.time()
|
137 |
logger.info(f"Provider settings updated. Prompt Loaded.Time taken : {end_time - start_time} seconds.")
|
138 |
|
|
|
|
|
|
|
|
|
139 |
start_time = time.time()
|
140 |
logger.info("Generating responses...")
|
141 |
-
|
142 |
-
|
|
|
|
|
143 |
llm_sampling_settings=settings,
|
144 |
-
returns_streaming_generator =
|
145 |
print_output = False
|
146 |
)
|
|
|
|
|
|
|
147 |
logger.info(f"Responses generated. Time taken : {time.time() - start_time} seconds.")
|
148 |
|
149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
|
151 |
DESCRIPTION = '''
|
152 |
<div>
|
|
|
136 |
end_time = time.time()
|
137 |
logger.info(f"Provider settings updated. Prompt Loaded.Time taken : {end_time - start_time} seconds.")
|
138 |
|
139 |
+
chunks = chunk_text(message)
|
140 |
+
|
141 |
+
responses = []
|
142 |
+
|
143 |
start_time = time.time()
|
144 |
logger.info("Generating responses...")
|
145 |
+
|
146 |
+
for chunk in chunks:
|
147 |
+
response = agent.get_chat_response(
|
148 |
+
chunk,
|
149 |
llm_sampling_settings=settings,
|
150 |
+
returns_streaming_generator = True, #generate streamer
|
151 |
print_output = False
|
152 |
)
|
153 |
+
|
154 |
+
responses.append(response)
|
155 |
+
|
156 |
logger.info(f"Responses generated. Time taken : {time.time() - start_time} seconds.")
|
157 |
|
158 |
+
output = ""
|
159 |
+
|
160 |
+
for response in responses:
|
161 |
+
for text in response:
|
162 |
+
output += text
|
163 |
+
|
164 |
+
yield output
|
165 |
|
166 |
DESCRIPTION = '''
|
167 |
<div>
|