a100 kh commited on
Commit
34c2c1b
1 Parent(s): 104a909
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -36,6 +36,8 @@ def respond(
36
 
37
  response = ""
38
 
 
 
39
  completion = client.chat.completions.create(model=model_name,
40
  messages=messages,
41
  temperature=temperature,
@@ -44,8 +46,7 @@ def respond(
44
  )
45
  text = completion.choices[0].message.content.strip()
46
  return text
47
-
48
- # streamは一旦無効化
49
  for message in client.chat.completions.create(
50
  model=model_name,
51
  messages=messages,
@@ -56,7 +57,9 @@ def respond(
56
  ):
57
  token = message.choices[0].delta.content
58
 
59
- response += token
 
 
60
  yield response
61
 
62
 
 
36
 
37
  response = ""
38
 
39
+ """
40
+ #streaming無し: gradio側が対応してない
41
  completion = client.chat.completions.create(model=model_name,
42
  messages=messages,
43
  temperature=temperature,
 
46
  )
47
  text = completion.choices[0].message.content.strip()
48
  return text
49
+ """
 
50
  for message in client.chat.completions.create(
51
  model=model_name,
52
  messages=messages,
 
57
  ):
58
  token = message.choices[0].delta.content
59
 
60
+ # response += token
61
+ if token is not None:
62
+ response += (token)
63
  yield response
64
 
65