shahzaibelbert's picture
Update app.py
9033977
raw
history blame contribute delete
No virus
1.04 kB
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()