Jia0603 commited on
Commit
67906f8
·
verified ·
1 Parent(s): c72e69a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -36,14 +36,15 @@ def chat_with_model(user_message, chat_history, max_new_tokens=60, temperature=0
36
 
37
  # Generate
38
  outputs = generator(
39
- history_text,
40
- max_new_tokens=int(max_new_tokens),
41
- do_sample=True,
42
- temperature=float(temperature),
43
- top_p=float(top_p)
44
- )
45
-
46
- reply = outputs[0]["generated_text"][len(history_text):].strip()
 
47
 
48
  if "\n" in reply:
49
  reply = reply.split("\n")[0].strip()
 
36
 
37
  # Generate
38
  outputs = generator(
39
+ history_text,
40
+ max_new_tokens=int(max_new_tokens),
41
+ do_sample=True,
42
+ temperature=float(temperature),
43
+ top_p=float(top_p)
44
+ )
45
+
46
+ raw = outputs[0]["generated_text"][len(history_text):]
47
+ reply = clean_reply(raw)
48
 
49
  if "\n" in reply:
50
  reply = reply.split("\n")[0].strip()