ThongCoding commited on
Commit
75b947c
·
verified ·
1 Parent(s): abc08ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
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 message 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
  ):
45
  # Tiến hành nhận phản hồi từ mô hình
46
- token = message["choices"][0]["delta"]["content"]
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: