Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import AutoModelForImageClassification, pipeline, AutoImageProcessor, SwinForImageClassification
|
| 3 |
from torchvision import transforms
|
| 4 |
|
| 5 |
-
model = AutoModelForImageClassification.from_pretrained("haywoodsloan/ai-image-detector-deploy")
|
|
|
|
|
|
|
| 6 |
image_processor = AutoImageProcessor.from_pretrained("haywoodsloan/ai-image-detector-deploy")
|
|
|
|
|
|
|
| 7 |
clf = pipeline(model=model, task="image-classification", image_processor=image_processor)
|
| 8 |
|
| 9 |
class_names = ['artificial', 'real']
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import AutoBackbone, AutoModelForImageClassification, pipeline, AutoImageProcessor, SwinForImageClassification
|
| 3 |
from torchvision import transforms
|
| 4 |
|
| 5 |
+
# model = AutoModelForImageClassification.from_pretrained("haywoodsloan/ai-image-detector-deploy")
|
| 6 |
+
# image_processor = AutoImageProcessor.from_pretrained("haywoodsloan/ai-image-detector-deploy")
|
| 7 |
+
|
| 8 |
image_processor = AutoImageProcessor.from_pretrained("haywoodsloan/ai-image-detector-deploy")
|
| 9 |
+
model = AutoBackbone.from_pretrained("haywoodsloan/ai-image-detector-deploy", out_indices=(1,))
|
| 10 |
+
|
| 11 |
clf = pipeline(model=model, task="image-classification", image_processor=image_processor)
|
| 12 |
|
| 13 |
class_names = ['artificial', 'real']
|