jer233 commited on
Commit
cff9378
·
verified ·
1 Parent(s): caef169

Update demo.py

Browse files
Files changed (1) hide show
  1. demo.py +32 -31
demo.py CHANGED
@@ -43,11 +43,6 @@ css = """
43
  margin: 0 5px;
44
  color: black;
45
  }
46
- .row {
47
- display: flex;
48
- justify-content: center;
49
- width: 100%;
50
- }
51
  """
52
 
53
  # Gradio App
@@ -55,15 +50,17 @@ with gr.Blocks(css=css) as app:
55
  with gr.Row():
56
  gr.HTML('<div id="header">R-detect On HuggingFace</div>')
57
  with gr.Row():
58
- gr.HTML("""
59
- <div class="links">
60
- <a href="https://openreview.net/forum?id=z9j7wctoGV" target="_blank">Paper</a>
61
- <span class="separator">|</span>
62
- <a href="https://github.com/xLearn-AU/R-Detect" target="_blank">Code</a>
63
- <span class="separator">|</span>
64
- <a href="mailto:[email protected]" target="_blank">Contact</a>
65
- </div>
66
- """)
 
 
67
  with gr.Row():
68
  input_text = gr.Textbox(
69
  label="Input Text",
@@ -72,7 +69,7 @@ with gr.Blocks(css=css) as app:
72
  )
73
  output = gr.Textbox(
74
  label="Inference Result",
75
- placeholder="Made by Human or AI",
76
  elem_id="output-text",
77
  )
78
  with gr.Row():
@@ -87,27 +84,31 @@ with gr.Blocks(css=css) as app:
87
  )
88
  submit_button = gr.Button("Run Detection", variant="primary")
89
  clear_button = gr.Button("Clear", variant="secondary")
 
90
 
91
- # Hooking up the change_mode function to select different models
92
  submit_button.click(run_test_power, inputs=[model_name, input_text, input_text], outputs=output)
93
  clear_button.click(lambda: ("", ""), inputs=[], outputs=[input_text, output])
 
94
 
95
  with gr.Accordion("Disclaimer", open=False):
96
- gr.Markdown("""
97
- - **Disclaimer**: This tool is for demonstration purposes only. It is not a foolproof AI detector.
98
- - **Accuracy**: Results may vary based on input length and quality.
99
- """)
100
-
 
101
  with gr.Accordion("Citations", open=False):
102
- gr.Markdown("""
103
- ```
104
- @inproceedings{zhangs2024MMDMP,
105
- title={Detecting Machine-Generated Texts by Multi-Population Aware Optimization for Maximum Mean Discrepancy},
106
- author={Zhang, Shuhai and Song, Yiliao and Yang, Jiahao and Li, Yuanqing and Han, Bo and Tan, Mingkui},
107
- booktitle = {International Conference on Learning Representations (ICLR)},
108
- year={2024}
109
- }
110
- ```
111
- """)
 
 
112
 
113
  app.launch()
 
43
  margin: 0 5px;
44
  color: black;
45
  }
 
 
 
 
 
46
  """
47
 
48
  # Gradio App
 
50
  with gr.Row():
51
  gr.HTML('<div id="header">R-detect On HuggingFace</div>')
52
  with gr.Row():
53
+ gr.HTML(
54
+ """
55
+ <div class="links">
56
+ <a href="https://openreview.net/forum?id=z9j7wctoGV" target="_blank">Paper</a>
57
+ <span class="separator">|</span>
58
+ <a href="https://github.com/xLearn-AU/R-Detect" target="_blank">Code</a>
59
+ <span class="separator">|</span>
60
+ <a href="mailto:[email protected]" target="_blank">Contact</a>
61
+ </div>
62
+ """
63
+ )
64
  with gr.Row():
65
  input_text = gr.Textbox(
66
  label="Input Text",
 
69
  )
70
  output = gr.Textbox(
71
  label="Inference Result",
72
+ placeholder="Maked by Human or AI",
73
  elem_id="output-text",
74
  )
75
  with gr.Row():
 
84
  )
85
  submit_button = gr.Button("Run Detection", variant="primary")
86
  clear_button = gr.Button("Clear", variant="secondary")
87
+
88
 
 
89
  submit_button.click(run_test_power, inputs=[model_name, input_text, input_text], outputs=output)
90
  clear_button.click(lambda: ("", ""), inputs=[], outputs=[input_text, output])
91
+ # model_name.change(change_mode, inputs=[model_name], outputs=[model_name])
92
 
93
  with gr.Accordion("Disclaimer", open=False):
94
+ gr.Markdown(
95
+ """
96
+ - **Disclaimer**: This tool is for demonstration purposes only. It is not a foolproof AI detector.
97
+ - **Accuracy**: Results may vary based on input length and quality.
98
+ """
99
+ )
100
  with gr.Accordion("Citations", open=False):
101
+ gr.Markdown(
102
+ """
103
+ ```
104
+ @inproceedings{zhangs2024MMDMP,
105
+ title={Detecting Machine-Generated Texts by Multi-Population Aware Optimization for Maximum Mean Discrepancy},
106
+ author={Zhang, Shuhai and Song, Yiliao and Yang, Jiahao and Li, Yuanqing and Han, Bo and Tan, Mingkui},
107
+ booktitle = {International Conference on Learning Representations (ICLR)},
108
+ year={2024}
109
+ }
110
+ ```
111
+ """
112
+ )
113
 
114
  app.launch()