Update app.py
Browse files
app.py
CHANGED
|
@@ -14,13 +14,12 @@ model_1 = model_1.to(device)
|
|
| 14 |
clf_1 = pipeline(model=model_1, task="image-classification", image_processor=image_processor_1, device=device)
|
| 15 |
|
| 16 |
# Load the second model
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
clf_2 = pipeline("image-classification", model=f"{hfUser}/{modelName}")
|
| 20 |
|
| 21 |
# Define class names for both models
|
| 22 |
class_names_1 = ['artificial', 'real']
|
| 23 |
-
class_names_2 = ['
|
| 24 |
|
| 25 |
def predict_image(img, confidence_threshold):
|
| 26 |
# Ensure the image is a PIL Image
|
|
|
|
| 14 |
clf_1 = pipeline(model=model_1, task="image-classification", image_processor=image_processor_1, device=device)
|
| 15 |
|
| 16 |
# Load the second model
|
| 17 |
+
model_2_path = "Heem2/AI-vs-Real-Image-Detection"
|
| 18 |
+
clf_2 = pipeline("image-classification", model=model_2_path)
|
|
|
|
| 19 |
|
| 20 |
# Define class names for both models
|
| 21 |
class_names_1 = ['artificial', 'real']
|
| 22 |
+
class_names_2 = ['AI Image', 'Real Image'] # Adjust if the second model has different classes
|
| 23 |
|
| 24 |
def predict_image(img, confidence_threshold):
|
| 25 |
# Ensure the image is a PIL Image
|