Spaces:
Sleeping
Sleeping
from transformers import pipeline | |
import gradio as gr | |
model = pipeline("text-classification", model="theArijitDas/distilbert-finetuned-fake-reviews-dataset") | |
# List of AI-related keywords | |
ai_keywords = [ | |
"AI chatbot", "Generated by AI", "Machine learning", "Artificial intelligence", "Deep learning", | |
"As a language model", "Powered by AI", "As an AI assistant", "Trained by neural networks", | |
"As an AI model", "Based on AI technology", "AI-generated", "AI-powered", "Algorithmic content", | |
"Automated text", "Computer-generated", "Generated by machine", "Created by AI", "Synthetic text", | |
"AI-driven", "Using natural language processing", "As an AI language model", "AI system", "AI-based", | |
"AI assistance", "Generated by machine learning", "AI capabilities", "AI algorithms", "Produced by AI", | |
"Automated response", "As an artificial intelligence", "With AI support", "AI-generated content", | |
"AI-enhanced", "Using deep learning", "Generated using algorithms", "Created by machine learning", | |
"Produced by machine learning", "Automated generation", "Computer-generated response", "AI-based content", | |
"AI-generated text", "Machine-produced", "AI-processed", "AI-generated response", "With machine learning", | |
"By artificial intelligence", "AI-created", "Neural network", "Generated by a computer", | |
"Automated content creation", "Created by algorithms", "Synthesized text", "AI-crafted", | |
"Text produced by AI", "AI content generation", "Programmatically generated", "Generated by neural networks", | |
"AI-assisted", "AI text generator", "Generated by NLP", "As a neural network", "AI text creation", | |
"Machine learning model", "AI-generated language", "Automated writing", "NLP-generated", "Text by AI", | |
"AI-produced", "AI-enabled", "Algorithm-driven content", "As an intelligent system", "Machine-authored", | |
"AI text", "AI machine learning", "AI language processing", "Text generated by AI", "Automated AI", | |
"AI language model", "Generated with AI", "Algorithmic text", "AI-authored", "With artificial intelligence", | |
"By machine learning algorithms", "AI-generated phrases", "Computer-created", "AI neural networks", | |
"Machine-generated text", "Automated neural network", "AI content", "AI-powered generation", | |
"AI textual content", "AI natural language", "Machine-generated content", "AI-driven text", | |
"Neural network-generated", "AI output", "Generated by artificial intelligence", "Automated generation by AI", | |
"AI synthetic text", "AI bot", | |
] | |
def contains_ai_keywords(text): | |
for keyword in ai_keywords: | |
if keyword.lower() in text.lower(): | |
return True | |
return False | |
def classify_review_with_model(text): | |
label = model(text)[0]['label'] | |
return label | |
def classify(text): | |
if contains_ai_keywords(text): | |
return "FAKE" # Flag as AI-generated | |
else: | |
return classify_review_with_model(text) | |
iface = gr.Interface(classify, | |
inputs=["text"], | |
outputs=["text"], | |
title="Fake Review Detector", | |
description="Enter product review to classify it as REAL or FAKE.") | |
iface.launch() |