beyond commited on
Commit
a1df271
0 Parent(s):

Duplicate from Hello-SimpleAI/chatgpt-detector-single

Browse files
Files changed (4) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +63 -0
  4. requirements.txt +2 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Chatgpt Detector Single
3
+ emoji: 😻
4
+ colorFrom: green
5
+ colorTo: indigo
6
+ sdk: gradio
7
+ sdk_version: 3.16.1
8
+ app_file: app.py
9
+ pinned: false
10
+ duplicated_from: Hello-SimpleAI/chatgpt-detector-single
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from transformers import pipeline
4
+
5
+ auth_token = os.environ.get("access_token")
6
+ pipeline_en = pipeline(task="text-classification", model="Hello-SimpleAI/chatgpt-detector-single",use_auth_token=auth_token)
7
+ pipeline_zh = pipeline(task="text-classification", model="Hello-SimpleAI/chatgpt-detector-single-chinese",use_auth_token=auth_token)
8
+
9
+
10
+
11
+ def predict_en(text):
12
+ res = pipeline_en(text)[0]
13
+ return res['label'],res['score']
14
+
15
+ def predict_zh(text):
16
+ res = pipeline_zh(text)[0]
17
+ return res['label'],res['score']
18
+
19
+
20
+
21
+
22
+ with gr.Blocks() as demo:
23
+ gr.Markdown("""
24
+ ## ChatGPT Detector 🔬 (Sinlge-text version)
25
+ Visit our project on Github: [chatgpt-comparison-detection project](https://github.com/Hello-SimpleAI/chatgpt-comparison-detection)<br>
26
+ 欢迎在 Github 上关注我们的 [ChatGPT 对比与检测项目](https://github.com/Hello-SimpleAI/chatgpt-comparison-detection)
27
+
28
+ We provide three kinds of detectors, all in Bilingual / 我们提供了三个版本的检测器,且都支持中英文:
29
+ - [**QA version / 问答版**](https://huggingface.co/spaces/Hello-SimpleAI/chatgpt-detector-qa)<br>
30
+ detect whether an **answer** is generated by ChatGPT for certain **question**, using PLM-based classifiers / 判断某个**问题的回答**是否由ChatGPT生成,使用基于PTM的分类器来开发;
31
+ - [Sinlge-text version / 独立文本版 (👈 Current / 当前使用)](https://huggingface.co/spaces/Hello-SimpleAI/chatgpt-detector-single)<br>
32
+ detect whether a piece of text is ChatGPT generated, using PLM-based classifiers / 判断**单条文本**是否由ChatGPT生成,使用基于PTM的分类器来开发;
33
+ - [Linguistic version / 语言学版](https://huggingface.co/spaces/Hello-SimpleAI/chatgpt-detector-ling)<br>
34
+ detect whether a piece of text is ChatGPT generated, using linguistic features / 判断**单条文本**是否由ChatGPT生成,使用基于语言学特征的模型来开发;
35
+
36
+
37
+ """)
38
+ with gr.Tab("English"):
39
+ gr.Markdown("""
40
+ Note: Providing more text to the `Text` box can make the prediction more accurate!
41
+ """)
42
+ t1 = gr.Textbox(lines=5, label='Text',value="There are a few things that can help protect your credit card information from being misused when you give it to a restaurant or any other business:\n\nEncryption: Many businesses use encryption to protect your credit card information when it is being transmitted or stored. This means that the information is transformed into a code that is difficult for anyone to read without the right key.")
43
+ button1 = gr.Button("🤖 Predict!")
44
+ label1 = gr.Textbox(lines=1, label='Predicted Label 🎃')
45
+ score1 = gr.Textbox(lines=1, label='Prob')
46
+ with gr.Tab("中文版"):
47
+ gr.Markdown("""
48
+ 注意: 在`文本`栏中输入更多的文本,可以让预测更准确哦!
49
+ """)
50
+ t2 = gr.Textbox(lines=5, label='文本',value="对于OpenAI大力出奇迹的工作,自然每个人都有自己的看点。我自己最欣赏的地方是ChatGPT如何解决 “AI校正(Alignment)“这个问题。这个问题也是我们课题组这两年在探索的学术问题之一。")
51
+ button2 = gr.Button("🤖 预测!")
52
+ label2 = gr.Textbox(lines=1, label='预测结果 🎃')
53
+ score2 = gr.Textbox(lines=1, label='模型概率')
54
+
55
+ button1.click(predict_en, inputs=[t1], outputs=[label1,score1], api_name='predict_en')
56
+ button2.click(predict_zh, inputs=[t2], outputs=[label2,score2], api_name='predict_zh')
57
+
58
+ # Page Count
59
+ gr.Markdown("""
60
+ <center><a href='https://clustrmaps.com/site/1bsdc' title='Visit tracker'><img src='//clustrmaps.com/map_v2.png?cl=080808&w=a&t=tt&d=NXQdnwxvIm27veMbB5F7oHNID09nhSvkBRZ_Aji9eIA&co=ffffff&ct=808080'/></a></center>
61
+ """)
62
+
63
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers
2
+ torch