File size: 1,041 Bytes
71bcc97
 
 
 
9033977
71bcc97
 
 
 
 
 
 
 
 
 
 
9033977
 
71bcc97
 
 
9033977
71bcc97
 
9033977
71bcc97
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import gradio as gr
from transformers import pipeline

auth_token = os.environ.get("access_token")
pipeline_en = pipeline(task="text-classification", model="Hello-SimpleAI/chatgpt-detector-roberta",use_auth_token=auth_token)


def predict_en(text):
    res = pipeline_en(text)[0]
    label = res['label']
    score = round(res['score']*100, 2)
    return "%d%% chance"%score, label


with gr.Blocks() as demo:
    gr.Markdown("AI Content Sentinel")
    with gr.Tab("Check Your Content For AI Plagiarism"):
        gr.Markdown("""
                    Note: Providing more text to the `Text` box can make the prediction more accurate!
                    """)
        t1 = gr.Textbox(lines=5, label='Paste the text you want to check',value="Paste Your Content Here")
        button1 = gr.Button("👀 See results")
        score1 = gr.Textbox(lines=1, label='There is a')
        label1 = gr.Textbox(lines=1, label='That this text is written by a')

    button1.click(predict_en, inputs=[t1], outputs=[score1, label1])

demo.launch()