Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -35,15 +35,16 @@ def respond(
|
|
35 |
|
36 |
# Gửi yêu cầu tới mô hình và nhận kết quả
|
37 |
try:
|
38 |
-
for
|
39 |
model="HuggingFaceH4/zephyr-7b-beta",
|
40 |
messages=messages,
|
41 |
max_tokens=max_tokens,
|
42 |
temperature=temperature,
|
43 |
top_p=top_p,
|
|
|
44 |
):
|
45 |
# Tiến hành nhận phản hồi từ mô hình
|
46 |
-
token =
|
47 |
response += token
|
48 |
|
49 |
except Exception as e:
|
|
|
35 |
|
36 |
# Gửi yêu cầu tới mô hình và nhận kết quả
|
37 |
try:
|
38 |
+
for chunk in client.chat_completion(
|
39 |
model="HuggingFaceH4/zephyr-7b-beta",
|
40 |
messages=messages,
|
41 |
max_tokens=max_tokens,
|
42 |
temperature=temperature,
|
43 |
top_p=top_p,
|
44 |
+
stream=True
|
45 |
):
|
46 |
# Tiến hành nhận phản hồi từ mô hình
|
47 |
+
token = chunk["choices"][0]["delta"]["content"]
|
48 |
response += token
|
49 |
|
50 |
except Exception as e:
|