Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline, AutoConfig, AutoModel
|
| 3 |
-
import torch
|
| 4 |
|
| 5 |
model_id = "KenLumod/ML-Fake-Real-News-Detector-Final"
|
| 6 |
|
|
@@ -9,13 +8,8 @@ config = AutoConfig.from_pretrained(model_id)
|
|
| 9 |
config.id2label = {1: "Fake News", 0: "Real News"} # Force override
|
| 10 |
config.label2id = {v: k for k, v in config.id2label.items()}
|
| 11 |
|
| 12 |
-
# Load the model using AutoModel
|
| 13 |
-
model = AutoModel.from_pretrained(
|
| 14 |
-
model_id,
|
| 15 |
-
config=config,
|
| 16 |
-
# Specify safe_tensors=True if using safetensors
|
| 17 |
-
safetensors=True
|
| 18 |
-
)
|
| 19 |
|
| 20 |
# Create the pipeline for classification
|
| 21 |
classifier = pipeline(
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline, AutoConfig, AutoModel
|
|
|
|
| 3 |
|
| 4 |
model_id = "KenLumod/ML-Fake-Real-News-Detector-Final"
|
| 5 |
|
|
|
|
| 8 |
config.id2label = {1: "Fake News", 0: "Real News"} # Force override
|
| 9 |
config.label2id = {v: k for k, v in config.id2label.items()}
|
| 10 |
|
| 11 |
+
# Load the model using AutoModel
|
| 12 |
+
model = AutoModel.from_pretrained(model_id, config=config)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Create the pipeline for classification
|
| 15 |
classifier = pipeline(
|