Spaces:
Sleeping
Sleeping
Update demo_watermark.py
Browse files- demo_watermark.py +6 -6
demo_watermark.py
CHANGED
|
@@ -501,7 +501,7 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
| 501 |
check_prompt_partial = partial(check_prompt, model=model, device=device)
|
| 502 |
generate_partial = partial(generate, model=model, device=device)
|
| 503 |
detect_partial = partial(detect, device=device)
|
| 504 |
-
|
| 505 |
with gr.Tab("Welcome"):
|
| 506 |
with gr.Row():
|
| 507 |
with gr.Column(scale=2):
|
|
@@ -545,7 +545,7 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
| 545 |

|
| 546 |
"""
|
| 547 |
)
|
| 548 |
-
|
| 549 |
|
| 550 |
with gr.Tab("Generate & Detect"):
|
| 551 |
|
|
@@ -577,7 +577,7 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
| 577 |
return redecoded_input + f"\n\n[Prompt was truncated before generation due to length...]", args
|
| 578 |
else:
|
| 579 |
return orig_prompt, args
|
| 580 |
-
|
| 581 |
with gr.Tab("Detector Only"):
|
| 582 |
with gr.Row():
|
| 583 |
with gr.Column(scale=2):
|
|
@@ -589,7 +589,7 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
| 589 |
detection_result = gr.Dataframe(headers=["Metric", "Value"], interactive=False,row_count=7,col_count=2)
|
| 590 |
with gr.Row():
|
| 591 |
detect_btn = gr.Button("Detect")
|
| 592 |
-
|
| 593 |
# Parameter selection group
|
| 594 |
with gr.Accordion("Advanced Settings",open=False):
|
| 595 |
with gr.Row():
|
|
@@ -703,7 +703,7 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
| 703 |
the confidence of the detection based on the unlikeliness of this `z-score` observation.
|
| 704 |
"""
|
| 705 |
)
|
| 706 |
-
|
| 707 |
gr.HTML("""
|
| 708 |
<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings.
|
| 709 |
Follow the github link at the top and host the demo on your own GPU hardware to test out larger models.
|
|
@@ -712,7 +712,7 @@ def run_gradio(args, model=None, device=None, tokenizer=None):
|
|
| 712 |
<img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
| 713 |
<p/>
|
| 714 |
""")
|
| 715 |
-
|
| 716 |
|
| 717 |
# Register main generation tab click, outputing generations as well as a the encoded+redecoded+potentially truncated prompt and flag, then call detection
|
| 718 |
generate_btn.click(fn=check_prompt_partial, inputs=[prompt,session_args,session_tokenizer], outputs=[redecoded_input, truncation_warning, session_args]).success(
|
|
|
|
| 501 |
check_prompt_partial = partial(check_prompt, model=model, device=device)
|
| 502 |
generate_partial = partial(generate, model=model, device=device)
|
| 503 |
detect_partial = partial(detect, device=device)
|
| 504 |
+
|
| 505 |
with gr.Tab("Welcome"):
|
| 506 |
with gr.Row():
|
| 507 |
with gr.Column(scale=2):
|
|
|
|
| 545 |

|
| 546 |
"""
|
| 547 |
)
|
| 548 |
+
|
| 549 |
|
| 550 |
with gr.Tab("Generate & Detect"):
|
| 551 |
|
|
|
|
| 577 |
return redecoded_input + f"\n\n[Prompt was truncated before generation due to length...]", args
|
| 578 |
else:
|
| 579 |
return orig_prompt, args
|
| 580 |
+
|
| 581 |
with gr.Tab("Detector Only"):
|
| 582 |
with gr.Row():
|
| 583 |
with gr.Column(scale=2):
|
|
|
|
| 589 |
detection_result = gr.Dataframe(headers=["Metric", "Value"], interactive=False,row_count=7,col_count=2)
|
| 590 |
with gr.Row():
|
| 591 |
detect_btn = gr.Button("Detect")
|
| 592 |
+
|
| 593 |
# Parameter selection group
|
| 594 |
with gr.Accordion("Advanced Settings",open=False):
|
| 595 |
with gr.Row():
|
|
|
|
| 703 |
the confidence of the detection based on the unlikeliness of this `z-score` observation.
|
| 704 |
"""
|
| 705 |
)
|
| 706 |
+
|
| 707 |
gr.HTML("""
|
| 708 |
<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings.
|
| 709 |
Follow the github link at the top and host the demo on your own GPU hardware to test out larger models.
|
|
|
|
| 712 |
<img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
| 713 |
<p/>
|
| 714 |
""")
|
| 715 |
+
|
| 716 |
|
| 717 |
# Register main generation tab click, outputing generations as well as a the encoded+redecoded+potentially truncated prompt and flag, then call detection
|
| 718 |
generate_btn.click(fn=check_prompt_partial, inputs=[prompt,session_args,session_tokenizer], outputs=[redecoded_input, truncation_warning, session_args]).success(
|