Spaces:
Sleeping
Sleeping
Update image_detect.py
Browse files- image_detect.py +3 -3
image_detect.py
CHANGED
|
@@ -3,15 +3,15 @@ from transformers import CLIPProcessor, CLIPModel
|
|
| 3 |
from PIL import Image
|
| 4 |
|
| 5 |
class ImageDeepfakeDetector:
|
| 6 |
-
|
| 7 |
print("⚡ Loading Image AI Model...")
|
| 8 |
try:
|
|
|
|
| 9 |
self.model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
|
| 10 |
-
self.processor = CLIPProcessor.from_pretrained(
|
| 11 |
print("✅ Image Model Ready.")
|
| 12 |
except Exception as e:
|
| 13 |
print(f"❌ Error: {e}")
|
| 14 |
-
print("Run 'setup_model.py' first.")
|
| 15 |
exit()
|
| 16 |
|
| 17 |
def predict(self, image_path):
|
|
|
|
| 3 |
from PIL import Image
|
| 4 |
|
| 5 |
class ImageDeepfakeDetector:
|
| 6 |
+
def __init__(self):
|
| 7 |
print("⚡ Loading Image AI Model...")
|
| 8 |
try:
|
| 9 |
+
# Both model and processor now pull directly from Hugging Face!
|
| 10 |
self.model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
|
| 11 |
+
self.processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
|
| 12 |
print("✅ Image Model Ready.")
|
| 13 |
except Exception as e:
|
| 14 |
print(f"❌ Error: {e}")
|
|
|
|
| 15 |
exit()
|
| 16 |
|
| 17 |
def predict(self, image_path):
|