Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from inference import EnsembleInference
|
| 3 |
+
|
| 4 |
+
model = EnsembleInference("Final_Model.pt")
|
| 5 |
+
|
| 6 |
+
def predict_text(text):
|
| 7 |
+
result = model.predict(text)
|
| 8 |
+
return f"{result['prediction']} (Confidence: {result['confidence']})\n\nDetails:\n- RoBERTa: {result['details']['roberta_confidence']}\n- DeBERTa: {result['details']['deberta_confidence']}"
|
| 9 |
+
|
| 10 |
+
iface = gr.Interface(
|
| 11 |
+
fn=predict_text,
|
| 12 |
+
inputs=gr.Textbox(lines=5, placeholder="Enter your text here..."),
|
| 13 |
+
outputs="text",
|
| 14 |
+
title="AI Detector",
|
| 15 |
+
description="This model detects whether the text is AI-generated or human-written using an ensemble of RoBERTa and DeBERTa."
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
iface.launch()
|