Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ else:
|
|
| 17 |
def generate_response(passage: str, question: str) -> str:
|
| 18 |
# Prepare the input text by combining the passage and question
|
| 19 |
messages = [{"role": "user", "content": f"Passage: {passage}\nQuestion: {question}"}]
|
| 20 |
-
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
| 21 |
|
| 22 |
# Generate text, focusing only on the new tokens added by the model
|
| 23 |
outputs = model.generate(**inputs, max_new_tokens=150)
|
|
|
|
| 17 |
def generate_response(passage: str, question: str) -> str:
|
| 18 |
# Prepare the input text by combining the passage and question
|
| 19 |
messages = [{"role": "user", "content": f"Passage: {passage}\nQuestion: {question}"}]
|
| 20 |
+
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
|
| 21 |
|
| 22 |
# Generate text, focusing only on the new tokens added by the model
|
| 23 |
outputs = model.generate(**inputs, max_new_tokens=150)
|