Update app.py
Browse files
app.py
CHANGED
@@ -20,12 +20,13 @@ clf_1 = pipeline(model=model_1, task="image-classification", image_processor=ima
|
|
20 |
|
21 |
# Load the second model
|
22 |
model_2_path = "Heem2/AI-vs-Real-Image-Detection"
|
23 |
-
clf_2 = pipeline("image-classification", model=model_2_path)
|
24 |
|
25 |
# Define class names for both models
|
26 |
class_names_1 = ['artificial', 'real']
|
27 |
class_names_2 = ['AI Image', 'Real Image'] # Adjust if the second model has different classes
|
28 |
|
|
|
29 |
def predict_image(img, confidence_threshold):
|
30 |
# Ensure the image is a PIL Image
|
31 |
if not isinstance(img, Image.Image):
|
|
|
20 |
|
21 |
# Load the second model
|
22 |
model_2_path = "Heem2/AI-vs-Real-Image-Detection"
|
23 |
+
clf_2 = pipeline("image-classification", model=model_2_path, device=device)
|
24 |
|
25 |
# Define class names for both models
|
26 |
class_names_1 = ['artificial', 'real']
|
27 |
class_names_2 = ['AI Image', 'Real Image'] # Adjust if the second model has different classes
|
28 |
|
29 |
+
@spaces.GPU(duration=30)
|
30 |
def predict_image(img, confidence_threshold):
|
31 |
# Ensure the image is a PIL Image
|
32 |
if not isinstance(img, Image.Image):
|