Spaces:
Runtime error
Runtime error
File size: 1,297 Bytes
ebf50d7 76e9ce0 ebf50d7 76e9ce0 ebf50d7 76e9ce0 ebf50d7 76e9ce0 ebf50d7 76e9ce0 ebf50d7 76e9ce0 |
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 30 31 32 33 34 35 36 37 38 |
import gradio as gr
from generated_text_detector.utils.text_detector import GeneratedTextDetector
# Инициализация детектора
detector = GeneratedTextDetector(
"SuperAnnotate/ai-detector",
device="cuda",
preprocessing=True
)
# Функция для предсказания
def detect_generated_text(input_text):
try:
result = detector.detect_report(input_text)
return f"Detection Result:\n\n{result}"
except Exception as e:
return f"Error: {str(e)}"
# Создание интерфейса Gradio
interface = gr.Interface(
fn=detect_generated_text,
inputs=gr.Textbox(
lines=5,
placeholder="Enter text here to check if it's AI-generated...",
label="Input Text"
),
outputs=gr.Textbox(label="Detection Result"),
title="AI-Generated Text Detector",
description="Enter any text to determine if it was generated by AI. Powered by SuperAnnotate/ai-detector model.",
examples=[
["It's not uncommon for people to develop allergies or intolerances to certain foods as they get older."],
["The quick brown fox jumps over the lazy dog near the river bank on a sunny afternoon."]
]
)
# Запуск интерфейса
if __name__ == "__main__":
interface.launch() |