Update input prompt to allow chat
Browse files
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 = """
|
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})
|