moriire commited on
Commit
66da31c
1 Parent(s): 0b4fed2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -76,8 +76,12 @@ async def complete(
76
  seed=seed,
77
  stream=True
78
  )
79
- for item in output:
80
- print(item['choices'][0])#['text'], end='')
 
 
 
 
81
  et = time()
82
  output["time"] = et - st
83
  #return output
 
76
  seed=seed,
77
  stream=True
78
  )
79
+ for chunk in output:
80
+ delta = chunk['choices'][0]['delta']
81
+ if 'role' in delta:
82
+ print(delta['role'], end=': ')
83
+ elif 'content' in delta:
84
+ print(delta['content'], end='')
85
  et = time()
86
  output["time"] = et - st
87
  #return output