chansung commited on
Commit
1e3dfee
1 Parent(s): caf9a86

Update app/main.py

Browse files
Files changed (1) hide show
  1. app/main.py +3 -6
app/main.py CHANGED
@@ -41,17 +41,14 @@ async def echo(message, history):
41
  messages = _translate_messages(history)
42
  messages.append({"role":"user", "content":message})
43
 
44
- history.append([message, ""])
45
- full_resp = ""
46
-
47
  responses = await client.chat.completions.create(
48
  model="tgi", messages=messages, **parameters
49
  )
50
-
 
51
  async for resp in responses:
52
  full_resp = full_resp + resp.choices[0].delta.content
53
- history[-1][1] = full_resp
54
- yield history
55
 
56
  demo = gr.ChatInterface(
57
  fn=echo,
 
41
  messages = _translate_messages(history)
42
  messages.append({"role":"user", "content":message})
43
 
 
 
 
44
  responses = await client.chat.completions.create(
45
  model="tgi", messages=messages, **parameters
46
  )
47
+
48
+ full_resp = ""
49
  async for resp in responses:
50
  full_resp = full_resp + resp.choices[0].delta.content
51
+ yield full_resp
 
52
 
53
  demo = gr.ChatInterface(
54
  fn=echo,