multimodalart HF Staff commited on
Commit
dba4082
·
verified ·
1 Parent(s): db6855d

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -267,11 +267,18 @@ def solve(
267
  pos = full_text.rfind(prompt)
268
  completion = full_text[pos + len(prompt):] if pos != -1 else full_text
269
  completion = strip_after_stop_text(completion, STOP_STRINGS)
270
- return completion.strip()
271
 
272
  # Raw mode: return the full continued expression.
273
  completion = strip_after_stop_text(full_text, STOP_STRINGS)
274
- return completion.strip()
 
 
 
 
 
 
 
275
 
276
 
277
  CSS = """
 
267
  pos = full_text.rfind(prompt)
268
  completion = full_text[pos + len(prompt):] if pos != -1 else full_text
269
  completion = strip_after_stop_text(completion, STOP_STRINGS)
270
+ return _clean(completion)
271
 
272
  # Raw mode: return the full continued expression.
273
  completion = strip_after_stop_text(full_text, STOP_STRINGS)
274
+ return _clean(completion)
275
+
276
+
277
+ def _clean(text: str) -> str:
278
+ """Display-only cleanup: drop the training-artifact `/no think` control
279
+ marker the model sometimes appends. Does not affect generation."""
280
+ text = strip_after_stop_text(text, [NO_THINK])
281
+ return text.strip()
282
 
283
 
284
  CSS = """