Spaces:
Running
Running
jonathanjordan21
commited on
Commit
•
bdd9aa8
1
Parent(s):
0bbd9e3
Update networks/huggingface_streamer.py
Browse files
networks/huggingface_streamer.py
CHANGED
@@ -209,7 +209,7 @@ class HuggingfaceStreamer:
|
|
209 |
output['repsonse'] = output['choices'][-1]['delta'].get('content')
|
210 |
output['done'] = output['choices'][-1].get('finish_reason')
|
211 |
output['created_at'] = output.get('created')
|
212 |
-
yield output
|
213 |
|
214 |
if not is_finished:
|
215 |
final_output = self.message_outputer.output(content="", content_type="Finished")
|
@@ -217,5 +217,5 @@ class HuggingfaceStreamer:
|
|
217 |
final_output = final_output['choices'][-1]['delta'].get('content')
|
218 |
final_output['done'] = output['choices'][-1].get('finish_reason')
|
219 |
final_output['created_at'] = final_output.get('created')
|
220 |
-
yield final_output
|
221 |
# yield self.message_outputer.output(content="", content_type="Finished").split('data: ')[1]
|
|
|
209 |
output['repsonse'] = output['choices'][-1]['delta'].get('content')
|
210 |
output['done'] = output['choices'][-1].get('finish_reason')
|
211 |
output['created_at'] = output.get('created')
|
212 |
+
yield json.dumps(output)
|
213 |
|
214 |
if not is_finished:
|
215 |
final_output = self.message_outputer.output(content="", content_type="Finished")
|
|
|
217 |
final_output = final_output['choices'][-1]['delta'].get('content')
|
218 |
final_output['done'] = output['choices'][-1].get('finish_reason')
|
219 |
final_output['created_at'] = final_output.get('created')
|
220 |
+
yield json.dumps(final_output)
|
221 |
# yield self.message_outputer.output(content="", content_type="Finished").split('data: ')[1]
|