Update app.py
Browse files
app.py
CHANGED
|
@@ -134,7 +134,7 @@ def answer_query(
|
|
| 134 |
|
| 135 |
prompt = (
|
| 136 |
"You are an ICSE board AI tutor. Answer ONLY using the textbook excerpt below. "
|
| 137 |
-
"Do NOT repeat yourself or echo the prompt. End your answer after one concise explanation.\n\n"
|
| 138 |
f"Textbook excerpt:\n{context}\n\n"
|
| 139 |
f"Student question: {question}\n"
|
| 140 |
"Answer:"
|
|
@@ -147,7 +147,7 @@ def answer_query(
|
|
| 147 |
tokenizer=tokenizer,
|
| 148 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 149 |
device=0 if torch.cuda.is_available() else -1,
|
| 150 |
-
max_new_tokens=
|
| 151 |
do_sample=False,
|
| 152 |
pad_token_id=tokenizer.eos_token_id
|
| 153 |
)
|
|
|
|
| 134 |
|
| 135 |
prompt = (
|
| 136 |
"You are an ICSE board AI tutor. Answer ONLY using the textbook excerpt below. "
|
| 137 |
+
"Do NOT repeat yourself or echo the prompt. You absolutely need to finish your sentence after giving a detailed response and your response HAS to be well-punctuated. End your answer after one concise explanation.\n\n"
|
| 138 |
f"Textbook excerpt:\n{context}\n\n"
|
| 139 |
f"Student question: {question}\n"
|
| 140 |
"Answer:"
|
|
|
|
| 147 |
tokenizer=tokenizer,
|
| 148 |
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
| 149 |
device=0 if torch.cuda.is_available() else -1,
|
| 150 |
+
max_new_tokens=64, # Keep short to reduce repeat loops
|
| 151 |
do_sample=False,
|
| 152 |
pad_token_id=tokenizer.eos_token_id
|
| 153 |
)
|