Update app.py
Browse files
app.py
CHANGED
|
@@ -34,16 +34,11 @@ class BasicAgent:
|
|
| 34 |
# Run the model
|
| 35 |
out = self.generator(
|
| 36 |
prompt,
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
pad_token_id=self.generator.tokenizer.eos_token_id
|
| 40 |
)
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
# split on the last "\nA:" or just on "A:" if needed
|
| 44 |
-
answer = text.split("\nA:")[-1].strip()
|
| 45 |
-
# final cleanup: no newlines, no trailing punctuation
|
| 46 |
-
return answer.replace("\n", " ").strip()
|
| 47 |
|
| 48 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 49 |
"""
|
|
|
|
| 34 |
# Run the model
|
| 35 |
out = self.generator(
|
| 36 |
prompt,
|
| 37 |
+
max_new_tokens=16, # leave room for the answer
|
| 38 |
+
return_full_text=False
|
|
|
|
| 39 |
)
|
| 40 |
+
answer = out[0]["generated_text"].strip()
|
| 41 |
+
return answer
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 44 |
"""
|