Spaces:
Runtime error
Runtime error
Antoine Chaffin
commited on
Commit
•
19b6ec4
1
Parent(s):
7e6b28b
Removing prompt from the generated text
Browse files
app.py
CHANGED
@@ -41,12 +41,12 @@ def embed(user, max_length, window_size, method, prompt):
|
|
41 |
max_length=max_length, method=method, prompt=prompt)
|
42 |
print("watermarked_texts: ", watermarked_texts)
|
43 |
|
44 |
-
return watermarked_texts[0]
|
45 |
|
46 |
def detect(attacked_text, window_size, method, prompt):
|
47 |
watermarker = Watermarker(tokenizer=tokenizer, model=model, window_size=window_size, payload_bits=PAYLOAD_BITS)
|
48 |
prompt = get_prompt(prompt)
|
49 |
-
pvalues, messages = watermarker.detect([ attacked_text ], key=args.key, method=method, prompts=[prompt])
|
50 |
|
51 |
print("messages: ", messages)
|
52 |
print("p-values: ", pvalues)
|
|
|
41 |
max_length=max_length, method=method, prompt=prompt)
|
42 |
print("watermarked_texts: ", watermarked_texts)
|
43 |
|
44 |
+
return watermarked_texts[0].replace(prompt, "")
|
45 |
|
46 |
def detect(attacked_text, window_size, method, prompt):
|
47 |
watermarker = Watermarker(tokenizer=tokenizer, model=model, window_size=window_size, payload_bits=PAYLOAD_BITS)
|
48 |
prompt = get_prompt(prompt)
|
49 |
+
pvalues, messages = watermarker.detect([ prompt + attacked_text ], key=args.key, method=method, prompts=[prompt])
|
50 |
|
51 |
print("messages: ", messages)
|
52 |
print("p-values: ", pvalues)
|