Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -674,7 +674,14 @@ with gr.Blocks(title="needle3 logits") as demo:
|
|
| 674 |
if not isinstance(qs, dict) or not qs:
|
| 675 |
return {"error": "questions must be a non-empty JSON object"}
|
| 676 |
qs = dict(qs)
|
| 677 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 678 |
return answer_tuned(state, qs)
|
| 679 |
|
| 680 |
tun_btn.click(_run_tuned, [st, tun_q], tun_out, api_name="tuned")
|
|
|
|
| 674 |
if not isinstance(qs, dict) or not qs:
|
| 675 |
return {"error": "questions must be a non-empty JSON object"}
|
| 676 |
qs = dict(qs)
|
| 677 |
+
# RESPECT a caller-supplied _request_text. This line used to be an
|
| 678 |
+
# unconditional `qs["_request_text"] = state`, which OVERWROTE the request
|
| 679 |
+
# portion the client sent and forced the full state as the scoping text.
|
| 680 |
+
# That re-introduced the reference-leak bug the adapter was built to avoid:
|
| 681 |
+
# a refund-policy sentence in the state armed the yes-side and the answer
|
| 682 |
+
# became yes for almost every policy question. The client knows which part
|
| 683 |
+
# of the state is the request; do not overwrite it.
|
| 684 |
+
qs.setdefault("_request_text", state)
|
| 685 |
return answer_tuned(state, qs)
|
| 686 |
|
| 687 |
tun_btn.click(_run_tuned, [st, tun_q], tun_out, api_name="tuned")
|