Orion
commited on
Commit
·
2c0d5fe
1
Parent(s):
52a09ee
fix: stream response
Browse files
app.py
CHANGED
@@ -86,12 +86,12 @@ def respond(
|
|
86 |
temperature=temperature,
|
87 |
top_p=top_p,
|
88 |
)
|
89 |
-
|
90 |
-
for
|
91 |
-
if
|
92 |
-
|
93 |
-
|
94 |
-
yield
|
95 |
|
96 |
|
97 |
with gr.Blocks(css=CSS) as demo:
|
|
|
86 |
temperature=temperature,
|
87 |
top_p=top_p,
|
88 |
)
|
89 |
+
message_repl = ""
|
90 |
+
for chunk in response:
|
91 |
+
if len(chunk['choices'][0]["delta"]) != 0 and "content" in chunk['choices'][0]["delta"]:
|
92 |
+
message_repl = message_repl + \
|
93 |
+
chunk['choices'][0]["delta"]["content"]
|
94 |
+
yield message_repl
|
95 |
|
96 |
|
97 |
with gr.Blocks(css=CSS) as demo:
|