saffr0n commited on
Commit
ca32be5
1 Parent(s): 2c169bc

Update input prompt to allow chat

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -25,9 +25,9 @@ As a derivate work of [Llama-2-7b-chat](https://huggingface.co/meta-llama/Llama-
25
  this demo is governed by the original [license](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat/blob/main/LICENSE.txt) and [acceptable use policy](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat/blob/main/USE_POLICY.md).
26
  """
27
 
28
- SYSTEM_PROMPT = ""
29
 
30
- PROMPT_TEMPLATE = """Below is a chat history between a user and an AI assistant (you). The user gives instructions. Write a response that appropriately completes the latest request.\n\n{% for message in messages %}{% if message['role'] == 'user' %}{{ '\n### Instruction:\n' + message['content'] + '\n'}}{% elif message['role'] == 'assistant' %}{{ '\n### Response:\n' + message['content'] + '\n'}}{% endif %}{% endfor %}\n\n### Response:\n"""
31
 
32
  if not torch.cuda.is_available():
33
  DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
@@ -51,6 +51,7 @@ def generate(
51
  top_k: int = 50,
52
  repetition_penalty: float = 1.2,
53
  ) -> Iterator[str]:
 
54
  conversation = []
55
  if system_prompt:
56
  conversation.append({"role": "system", "content": system_prompt})
 
25
  this demo is governed by the original [license](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat/blob/main/LICENSE.txt) and [acceptable use policy](https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat/blob/main/USE_POLICY.md).
26
  """
27
 
28
+ SYSTEM_PROMPT = "Below is an instruction that describes a task. Write a response that appropriately completes the request."
29
 
30
+ PROMPT_TEMPLATE = """{% if messages[0]['role'] == 'system' %}{{ messages[0]['content'] + '\n\n' }}{% endif %}### Instruction:\nWewe ni msaidizi wa AI unayepiga gumzo na mtumiaji.Hii ndiyo historia ya soga ya watu unaowasiliana nao kufikia sasa:\n\n{% for message in messages %}{% if message['role'] == 'user' %}{{ '\nUser: ' + message['content'] + '\n'}}{% elif message['role'] == 'assistant' %}{{ '\nAI: ' + message['content'] + '\n'}}{% endif %}{% endfor %}\n\nKama msaidizi wa AI, andika jibu lako linalofuata kwenye gumzo.\n\n### Response:\n"""
31
 
32
  if not torch.cuda.is_available():
33
  DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
 
51
  top_k: int = 50,
52
  repetition_penalty: float = 1.2,
53
  ) -> Iterator[str]:
54
+ print("chat history: ", chat_history)
55
  conversation = []
56
  if system_prompt:
57
  conversation.append({"role": "system", "content": system_prompt})