Toughen1 commited on
Commit
379f516
·
verified ·
1 Parent(s): 492cfb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -9
app.py CHANGED
@@ -1,9 +1,18 @@
1
  import gradio as gr
2
 
 
 
 
 
 
 
 
3
  title = "Neural Plagiarism Detection Demo"
4
  description = """# <p style="text-align: center;"> 🎩 🔎 Plagiarism Detection Demo 🔎 🎩</p>
5
- The model was trained on the [Machine Paraphrase Dataset](https://huggingface.co/datasets/jpwahle/machine-paraphrase-dataset) to detect machine-generated paraphrases. It works best for paraphrases from research papers, wikipedia, or graduation theses."""
 
6
 
 
7
  examples = [
8
  [
9
  "The North Pacific right whale seems to happen in two populaces. The"
@@ -24,7 +33,17 @@ examples = [
24
  " development designs are not known."
25
  ],
26
  [
27
- """On 12 June 1917, a long time before "Mutsu" was set down, Hiraga proposed a modified structure for the ship that mirrored the exercises from the Battle of Jutland that had happened the earlier year, and consolidated advances in kettle innovation. Given undertaking number A-125, his structure included an additional twin primary firearm turret, utilizing space and weight made accessible by the decrease of the quantity of boilers from 21 to 12, while the power continued as before. He diminished the auxiliary weapon from 20 firearms to 16, in spite of the fact that they were brought up in stature to improve their capacity to discharge amid overwhelming climate and to improve their bends of shoot. To expand the ship's insurance he proposed calculating the belt protection outwards to improve its protection from flat flame, and expanding the thickness of the lower deck protective layer and the torpedo bulkhead. Hiraga additionally intended to add against torpedo lumps to improve submerged security. He assessed that his ship would dislodge as much as "Nagato", in spite of the fact that it would cost around a million yen more. Hiraga's progressions would have impressively deferred "Mutsu"s fruition and were dismissed by the Navy Ministry."""
 
 
 
 
 
 
 
 
 
 
28
  ],
29
  [
30
  "On 24 February 2022, Russia invaded Ukraine in a major escalation of"
@@ -50,13 +69,16 @@ examples = [
50
  ],
51
  ]
52
 
53
- demo = gr.Interface.load(
54
- "huggingface/jpwahle/longformer-base-plagiarism-detection",
55
- inputs=gr.Textbox(lines=5, label="Input Text"),
56
- title=title,
57
- description=description,
58
- examples=examples,
 
 
59
  )
60
 
 
61
  if __name__ == "__main__":
62
- demo.launch()
 
1
  import gradio as gr
2
 
3
+ # 模拟模型的逻辑(实际可替换为加载 HuggingFace 模型的逻辑)
4
+ def plagiarism_detection(input_text):
5
+ # 在这里可以加载模型并运行预测逻辑
6
+ # 这里只是一个占位示例,返回一个模拟输出
7
+ return "Plagiarism detection result: This is a dummy output."
8
+
9
+ # 界面标题和描述
10
  title = "Neural Plagiarism Detection Demo"
11
  description = """# <p style="text-align: center;"> 🎩 🔎 Plagiarism Detection Demo 🔎 🎩</p>
12
+ The model was trained on the [Machine Paraphrase Dataset](https://huggingface.co/datasets/jpwahle/machine-paraphrase-dataset)
13
+ to detect machine-generated paraphrases. It works best for paraphrases from research papers, Wikipedia, or graduation theses."""
14
 
15
+ # 示例输入
16
  examples = [
17
  [
18
  "The North Pacific right whale seems to happen in two populaces. The"
 
33
  " development designs are not known."
34
  ],
35
  [
36
+ """On 12 June 1917, a long time before "Mutsu" was set down, Hiraga proposed a modified structure for the ship that
37
+ mirrored the exercises from the Battle of Jutland that had happened the earlier year, and consolidated advances in
38
+ kettle innovation. Given undertaking number A-125, his structure included an additional twin primary firearm turret,
39
+ utilizing space and weight made accessible by the decrease of the quantity of boilers from 21 to 12, while the power
40
+ continued as before. He diminished the auxiliary weapon from 20 firearms to 16, in spite of the fact that they were
41
+ brought up in stature to improve their capacity to discharge amid overwhelming climate and to improve their bends of shoot.
42
+ To expand the ship's insurance he proposed calculating the belt protection outwards to improve its protection from flat flame,
43
+ and expanding the thickness of the lower deck protective layer and the torpedo bulkhead. Hiraga additionally intended to add
44
+ against torpedo lumps to improve submerged security. He assessed that his ship would dislodge as much as "Nagato", in spite
45
+ of the fact that it would cost around a million yen more. Hiraga's progressions would have impressively deferred "Mutsu"s
46
+ fruition and were dismissed by the Navy Ministry."""
47
  ],
48
  [
49
  "On 24 February 2022, Russia invaded Ukraine in a major escalation of"
 
69
  ],
70
  ]
71
 
72
+ # 构造 Gradio 界面
73
+ demo = gr.Interface(
74
+ fn=plagiarism_detection, # 模型的处理函数
75
+ inputs=gr.Textbox(lines=5, label="Input Text"), # 输入组件
76
+ outputs="text", # 输出组件
77
+ title=title, # 界面标题
78
+ description=description, # 界面描述
79
+ examples=examples, # 示例
80
  )
81
 
82
+ # 启动 Gradio 应用
83
  if __name__ == "__main__":
84
+ demo.launch(share=True)