muryshev commited on
Commit
b4d7ce7
1 Parent(s): 2e8f16f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -14,12 +14,10 @@ client = OpenAI(
14
  def respond(
15
  message,
16
  history: list[tuple[str, str]],
17
- system_message,
18
  max_tokens,
19
  temperature,
20
  top_p,
21
  ):
22
- messages = [{"role": "system", "content": system_message}]
23
 
24
  for val in history:
25
  if val[0]:
@@ -40,8 +38,8 @@ def respond(
40
  messages=messages,
41
  ):
42
  token = message.choices[0].delta.content
43
-
44
- response += token
45
  yield response
46
 
47
  chatbot = gr.Chatbot(height=600)
@@ -49,7 +47,6 @@ chatbot = gr.Chatbot(height=600)
49
  service = gr.ChatInterface(
50
  respond,
51
  additional_inputs=[
52
- gr.Textbox(value=" ", label="Системный промпт"),
53
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Максимальная длина ответа"),
54
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Температура"),
55
  gr.Slider(
 
14
  def respond(
15
  message,
16
  history: list[tuple[str, str]],
 
17
  max_tokens,
18
  temperature,
19
  top_p,
20
  ):
 
21
 
22
  for val in history:
23
  if val[0]:
 
38
  messages=messages,
39
  ):
40
  token = message.choices[0].delta.content
41
+ if token is not None:
42
+ response += token
43
  yield response
44
 
45
  chatbot = gr.Chatbot(height=600)
 
47
  service = gr.ChatInterface(
48
  respond,
49
  additional_inputs=[
 
50
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Максимальная длина ответа"),
51
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Температура"),
52
  gr.Slider(