ranamhamoud commited on
Commit
8d0a419
·
verified ·
1 Parent(s): c6d89ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -32,6 +32,8 @@ def run_model(input_ids, model, max_new_tokens, top_p, top_k, temperature, repet
32
 
33
  def generate_text(mode: str, message: str, chat_history: List[Tuple[str, str]], max_new_tokens: int = DEFAULT_MAX_NEW_TOKENS,
34
  temperature: float = 0.6, top_p: float = 0.7, top_k: int = 20, repetition_penalty: float = 1.0) -> Iterator[str]:
 
 
35
  conversation = [{"role": "user", "content": user} for user, _ in chat_history]
36
  conversation.extend([{"role": "assistant", "content": assistant} for _, assistant in chat_history])
37
  conversation.append({"role": "user", "content": message})
 
32
 
33
  def generate_text(mode: str, message: str, chat_history: List[Tuple[str, str]], max_new_tokens: int = DEFAULT_MAX_NEW_TOKENS,
34
  temperature: float = 0.6, top_p: float = 0.7, top_k: int = 20, repetition_penalty: float = 1.0) -> Iterator[str]:
35
+ if chat_history is None:
36
+ chat_history = []
37
  conversation = [{"role": "user", "content": user} for user, _ in chat_history]
38
  conversation.extend([{"role": "assistant", "content": assistant} for _, assistant in chat_history])
39
  conversation.append({"role": "user", "content": message})