theArijitDas commited on
Commit
7d596e1
1 Parent(s): 2997735

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +54 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ model = pipeline("text-classification", model="theArijitDas/distilbert-finetuned-fake-reviews-dataset")
5
+
6
+ # List of AI-related keywords
7
+ ai_keywords = [
8
+ "AI chatbot", "Generated by AI", "Machine learning", "Artificial intelligence", "Deep learning",
9
+ "As a language model", "Powered by AI", "As an AI assistant", "Trained by neural networks",
10
+ "As an AI model", "Based on AI technology", "AI-generated", "AI-powered", "Algorithmic content",
11
+ "Automated text", "Computer-generated", "Generated by machine", "Created by AI", "Synthetic text",
12
+ "AI-driven", "Using natural language processing", "As an AI language model", "AI system", "AI-based",
13
+ "AI assistance", "Generated by machine learning", "AI capabilities", "AI algorithms", "Produced by AI",
14
+ "Automated response", "As an artificial intelligence", "With AI support", "AI-generated content",
15
+ "AI-enhanced", "Using deep learning", "Generated using algorithms", "Created by machine learning",
16
+ "Produced by machine learning", "Automated generation", "Computer-generated response", "AI-based content",
17
+ "AI-generated text", "Machine-produced", "AI-processed", "AI-generated response", "With machine learning",
18
+ "By artificial intelligence", "AI-created", "Neural network", "Generated by a computer",
19
+ "Automated content creation", "Created by algorithms", "Synthesized text", "AI-crafted",
20
+ "Text produced by AI", "AI content generation", "Programmatically generated", "Generated by neural networks",
21
+ "AI-assisted", "AI text generator", "Generated by NLP", "As a neural network", "AI text creation",
22
+ "Machine learning model", "AI-generated language", "Automated writing", "NLP-generated", "Text by AI",
23
+ "AI-produced", "AI-enabled", "Algorithm-driven content", "As an intelligent system", "Machine-authored",
24
+ "AI text", "AI machine learning", "AI language processing", "Text generated by AI", "Automated AI",
25
+ "AI language model", "Generated with AI", "Algorithmic text", "AI-authored", "With artificial intelligence",
26
+ "By machine learning algorithms", "AI-generated phrases", "Computer-created", "AI neural networks",
27
+ "Machine-generated text", "Automated neural network", "AI content", "AI-powered generation",
28
+ "AI textual content", "AI natural language", "Machine-generated content", "AI-driven text",
29
+ "Neural network-generated", "AI output", "Generated by artificial intelligence", "Automated generation by AI",
30
+ "AI synthetic text", "AI bot",
31
+ ]
32
+
33
+ def contains_ai_keywords(text):
34
+ for keyword in ai_keywords:
35
+ if keyword.lower() in text.lower():
36
+ return True
37
+ return False
38
+
39
+ def classify_review_with_model(text):
40
+ label = model(text)[0]['label']
41
+ return label
42
+
43
+ def classify(text):
44
+ if contains_ai_keywords(text):
45
+ return "FAKE" # Flag as AI-generated
46
+ else:
47
+ return classify_review_with_model(text)
48
+
49
+ iface = gr.Interface(classify,
50
+ inputs=["text"],
51
+ outputs=["text"],
52
+ title="Fake Review Detector",
53
+ description="Enter product review to classify it as REAL or FAKE.")
54
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ torch
3
+ gradio