Update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,8 @@ os.makedirs(upload_folder, exist_ok=True)
|
|
14 |
# Updated Fake News Detection Models
|
15 |
news_models = {
|
16 |
"mrm8488": pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-fake-news-detection"),
|
17 |
-
"
|
18 |
-
"
|
19 |
}
|
20 |
|
21 |
# Updated Image Models for AI vs. Human Detection
|
@@ -57,8 +57,8 @@ HTML_TEMPLATE = """
|
|
57 |
<label for="model">Select Fake News Model:</label>
|
58 |
<select name="model" required>
|
59 |
<option value="mrm8488">MRM8488 (BERT-Tiny)</option>
|
60 |
-
<option value="liam168">Liam168 (BERT)</option>
|
61 |
<option value="distilbert">DistilBERT (SST-2)</option>
|
|
|
62 |
</select>
|
63 |
<button type="submit">Detect News Authenticity</button>
|
64 |
</form>
|
@@ -100,7 +100,7 @@ def detect():
|
|
100 |
return render_template_string(HTML_TEMPLATE, news_prediction="Invalid input or model selection.")
|
101 |
|
102 |
result = news_models[model_key](text)[0]
|
103 |
-
label = "REAL" if result['label'].lower() in ["real", "label_1"] else "FAKE"
|
104 |
confidence = result['score'] * 100
|
105 |
|
106 |
return render_template_string(
|
|
|
14 |
# Updated Fake News Detection Models
|
15 |
news_models = {
|
16 |
"mrm8488": pipeline("text-classification", model="mrm8488/bert-tiny-finetuned-fake-news-detection"),
|
17 |
+
"distilbert": pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english"),
|
18 |
+
"cardiffnlp": pipeline("text-classification", model="cardiffnlp/twitter-roberta-base-offensive")
|
19 |
}
|
20 |
|
21 |
# Updated Image Models for AI vs. Human Detection
|
|
|
57 |
<label for="model">Select Fake News Model:</label>
|
58 |
<select name="model" required>
|
59 |
<option value="mrm8488">MRM8488 (BERT-Tiny)</option>
|
|
|
60 |
<option value="distilbert">DistilBERT (SST-2)</option>
|
61 |
+
<option value="cardiffnlp">CardiffNLP (RoBERTa-Offensive)</option>
|
62 |
</select>
|
63 |
<button type="submit">Detect News Authenticity</button>
|
64 |
</form>
|
|
|
100 |
return render_template_string(HTML_TEMPLATE, news_prediction="Invalid input or model selection.")
|
101 |
|
102 |
result = news_models[model_key](text)[0]
|
103 |
+
label = "REAL" if result['label'].lower() in ["real", "label_1", "neutral"] else "FAKE"
|
104 |
confidence = result['score'] * 100
|
105 |
|
106 |
return render_template_string(
|