Spaces:
Runtime error
Runtime error
new code
Browse files- src/pdfchatbot.py +2 -1
src/pdfchatbot.py
CHANGED
|
@@ -77,11 +77,12 @@ class PDFChatBot:
|
|
| 77 |
@spaces.GPU
|
| 78 |
def create_organic_response(self, history, query):
|
| 79 |
self.get_organic_context(query)
|
|
|
|
| 80 |
messages = [
|
| 81 |
{"role": "system", "content": "From the the contained given below, answer the question of user \n " + self.current_context},
|
| 82 |
{"role": "user", "content": query},
|
| 83 |
]
|
| 84 |
-
prompt =
|
| 85 |
messages,
|
| 86 |
tokenize=False,
|
| 87 |
add_generation_prompt=True
|
|
|
|
| 77 |
@spaces.GPU
|
| 78 |
def create_organic_response(self, history, query):
|
| 79 |
self.get_organic_context(query)
|
| 80 |
+
tokenizer = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
|
| 81 |
messages = [
|
| 82 |
{"role": "system", "content": "From the the contained given below, answer the question of user \n " + self.current_context},
|
| 83 |
{"role": "user", "content": query},
|
| 84 |
]
|
| 85 |
+
prompt = tokenizer.apply_chat_template(
|
| 86 |
messages,
|
| 87 |
tokenize=False,
|
| 88 |
add_generation_prompt=True
|