Spaces:
Runtime error
Runtime error
Update demo.py
Browse files
demo.py
CHANGED
@@ -64,17 +64,15 @@ with gr.Blocks(css=css) as app:
|
|
64 |
with gr.Row():
|
65 |
gr.HTML('<div id="header">R-detect On HuggingFace</div>')
|
66 |
with gr.Row():
|
67 |
-
gr.HTML(
|
68 |
-
|
69 |
-
<
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
"""
|
77 |
-
)
|
78 |
with gr.Row():
|
79 |
input_text = gr.Textbox(
|
80 |
label="Input Text",
|
@@ -83,7 +81,7 @@ with gr.Blocks(css=css) as app:
|
|
83 |
)
|
84 |
output = gr.Textbox(
|
85 |
label="Inference Result",
|
86 |
-
placeholder="
|
87 |
elem_id="output-text",
|
88 |
)
|
89 |
with gr.Row():
|
@@ -94,33 +92,31 @@ with gr.Blocks(css=css) as app:
|
|
94 |
"Powerful Model",
|
95 |
],
|
96 |
label="Select Model",
|
97 |
-
value="
|
98 |
)
|
99 |
submit_button = gr.Button("Run Detection", variant="primary")
|
100 |
clear_button = gr.Button("Clear", variant="secondary")
|
|
|
|
|
101 |
submit_button.click(run_test_power, inputs=[model_name, input_text, input_text], outputs=output)
|
102 |
clear_button.click(lambda: ("", ""), inputs=[], outputs=[input_text, output])
|
103 |
-
# model_name.change(change_mode, inputs=[model_name], outputs=[model_name])
|
104 |
|
105 |
with gr.Accordion("Disclaimer", open=False):
|
106 |
-
gr.Markdown(
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
)
|
112 |
with gr.Accordion("Citations", open=False):
|
113 |
-
gr.Markdown(
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
"""
|
124 |
-
)
|
125 |
|
126 |
app.launch()
|
|
|
64 |
with gr.Row():
|
65 |
gr.HTML('<div id="header">R-detect On HuggingFace</div>')
|
66 |
with gr.Row():
|
67 |
+
gr.HTML("""
|
68 |
+
<div class="links">
|
69 |
+
<a href="https://openreview.net/forum?id=z9j7wctoGV" target="_blank">Paper</a>
|
70 |
+
<span class="separator">|</span>
|
71 |
+
<a href="https://github.com/xLearn-AU/R-Detect" target="_blank">Code</a>
|
72 |
+
<span class="separator">|</span>
|
73 |
+
<a href="mailto:[email protected]" target="_blank">Contact</a>
|
74 |
+
</div>
|
75 |
+
""")
|
|
|
|
|
76 |
with gr.Row():
|
77 |
input_text = gr.Textbox(
|
78 |
label="Input Text",
|
|
|
81 |
)
|
82 |
output = gr.Textbox(
|
83 |
label="Inference Result",
|
84 |
+
placeholder="Made by Human or AI",
|
85 |
elem_id="output-text",
|
86 |
)
|
87 |
with gr.Row():
|
|
|
92 |
"Powerful Model",
|
93 |
],
|
94 |
label="Select Model",
|
95 |
+
value="Medium Model",
|
96 |
)
|
97 |
submit_button = gr.Button("Run Detection", variant="primary")
|
98 |
clear_button = gr.Button("Clear", variant="secondary")
|
99 |
+
|
100 |
+
# Hooking up the change_mode function to select different models
|
101 |
submit_button.click(run_test_power, inputs=[model_name, input_text, input_text], outputs=output)
|
102 |
clear_button.click(lambda: ("", ""), inputs=[], outputs=[input_text, output])
|
|
|
103 |
|
104 |
with gr.Accordion("Disclaimer", open=False):
|
105 |
+
gr.Markdown("""
|
106 |
+
- **Disclaimer**: This tool is for demonstration purposes only. It is not a foolproof AI detector.
|
107 |
+
- **Accuracy**: Results may vary based on input length and quality.
|
108 |
+
""")
|
109 |
+
|
|
|
110 |
with gr.Accordion("Citations", open=False):
|
111 |
+
gr.Markdown("""
|
112 |
+
```
|
113 |
+
@inproceedings{zhangs2024MMDMP,
|
114 |
+
title={Detecting Machine-Generated Texts by Multi-Population Aware Optimization for Maximum Mean Discrepancy},
|
115 |
+
author={Zhang, Shuhai and Song, Yiliao and Yang, Jiahao and Li, Yuanqing and Han, Bo and Tan, Mingkui},
|
116 |
+
booktitle = {International Conference on Learning Representations (ICLR)},
|
117 |
+
year={2024}
|
118 |
+
}
|
119 |
+
```
|
120 |
+
""")
|
|
|
|
|
121 |
|
122 |
app.launch()
|