Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,26 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
gr.Interface.load("models/Hello-SimpleAI/chatgpt-detector-roberta",
|
| 4 |
-
title="π€ Start detecting AI Plagiarism"
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
model = gr.Interface.load("models/Hello-SimpleAI/chatgpt-detector-roberta",
|
| 4 |
+
title="π€ Start detecting AI Plagiarism").launch()
|
| 5 |
+
|
| 6 |
+
def predict_en(text):
|
| 7 |
+
res = model(text)[0]
|
| 8 |
+
return res['label'],res['score']
|
| 9 |
+
|
| 10 |
+
with gr.Blocks() as demo:
|
| 11 |
+
gr.Markdown("""
|
| 12 |
+
Paste in the text you want to check and get a holistic score for how much of the document is written by AI. This model is based on Hello Simple's paper [arxiv: 2301.07597](https://arxiv.org/abs/2301.07597) and Github project [Hello-SimpleAI/chatgpt-comparison-detection](https://github.com/Hello-SimpleAI/chatgpt-comparison-detection).
|
| 13 |
+
""")
|
| 14 |
+
with gr.Tab("English"):
|
| 15 |
+
gr.Markdown("""
|
| 16 |
+
Note: Providing more text to the `Text` box can make the prediction more accurate!
|
| 17 |
+
""")
|
| 18 |
+
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.")
|
| 19 |
+
button1 = gr.Button("π€ Predict!")
|
| 20 |
+
label1 = gr.Textbox(lines=1, label='Predicted Label π')
|
| 21 |
+
score1 = gr.Textbox(lines=1, label='Prob')
|
| 22 |
+
|
| 23 |
+
button1.click(predict_en, inputs=[t1], outputs=[label1,score1])
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
demo.launch()
|