Spaces:
Runtime error
Runtime error
Afroz Alam
commited on
Commit
Β·
a0c9221
1
Parent(s):
ddb7260
initial commit
Browse files- README.md +4 -1
- app.py +29 -0
- requirement.txt +2 -0
README.md
CHANGED
@@ -3,7 +3,10 @@ title: AuthentiCheck
|
|
3 |
emoji: π’
|
4 |
colorFrom: indigo
|
5 |
colorTo: yellow
|
6 |
-
sdk:
|
|
|
|
|
|
|
7 |
pinned: false
|
8 |
license: mit
|
9 |
---
|
|
|
3 |
emoji: π’
|
4 |
colorFrom: indigo
|
5 |
colorTo: yellow
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.16.1
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
pinned: false
|
11 |
license: mit
|
12 |
---
|
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
def predict_en(text):
|
11 |
+
res = pipeline_en(text)[0]
|
12 |
+
return res['label'],res['score']
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
with gr.Blocks() as demo:
|
17 |
+
with gr.Tab("English"):
|
18 |
+
gr.Markdown("""
|
19 |
+
Note: Providing more text to the `Text` box can make the prediction more accurate!
|
20 |
+
""")
|
21 |
+
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.")
|
22 |
+
button1 = gr.Button("π€ Predict!")
|
23 |
+
label1 = gr.Textbox(lines=1, label='Predicted Label π')
|
24 |
+
score1 = gr.Textbox(lines=1, label='Prob')
|
25 |
+
|
26 |
+
button1.click(predict_en, inputs=[t1], outputs=[label1,score1])
|
27 |
+
|
28 |
+
|
29 |
+
demo.launch()
|
requirement.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|