Namitg02 commited on
Commit
b1641d0
·
verified ·
1 Parent(s): 295dec0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -147,6 +147,7 @@ def talk(prompt, history):
147
  stream = model.create_chat_completion(messages = [{"role":"system","content":SYS_PROMPT},{"role":"user","content":formatted_prompt}], max_tokens=1000, stop=["</s>"], stream=True)
148
  # print(output['choices'][0]['message']['content'])
149
  pprint.pprint(stream)
 
150
  for output in stream:
151
  text += output["choices"][0]["text"]
152
  yield text
@@ -162,10 +163,7 @@ def talk(prompt, history):
162
 
163
  # start = time.time()
164
  # NUM_TOKENS=0
165
- # print('-'*4+'Start Generation'+'-'*4)
166
- # for token in model.generate(input_ids):
167
- # print(model.detokenize(input_ids), end='', flush=True)
168
- # NUM_TOKENS+=1
169
  # time_generate = time.time() - start
170
  # print('\n')
171
  # print('-'*4+'End Generation'+'-'*4)
 
147
  stream = model.create_chat_completion(messages = [{"role":"system","content":SYS_PROMPT},{"role":"user","content":formatted_prompt}], max_tokens=1000, stop=["</s>"], stream=True)
148
  # print(output['choices'][0]['message']['content'])
149
  pprint.pprint(stream)
150
+ text = ""
151
  for output in stream:
152
  text += output["choices"][0]["text"]
153
  yield text
 
163
 
164
  # start = time.time()
165
  # NUM_TOKENS=0
166
+
 
 
 
167
  # time_generate = time.time() - start
168
  # print('\n')
169
  # print('-'*4+'End Generation'+'-'*4)