Instructions to use Organika/sdxl-detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Organika/sdxl-detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="Organika/sdxl-detector") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("Organika/sdxl-detector") model = AutoModelForImageClassification.from_pretrained("Organika/sdxl-detector") - Inference
- Notebooks
- Google Colab
- Kaggle
Transformer.js
#2
by ninini1 - opened
Hello,
Thank you for your work. Do you think you can make the model usable in javascript with transformer.js or any other way?
<script type="module">
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.1.0';
document.getElementById('runModel').addEventListener('click', async () => {
const fileInput = document.getElementById('imageInput');
if (fileInput.files.length === 0) {
alert('Veuillez sélectionner une image.');
return;
}
const imageFile = fileInput.files[0];
const imageBitmap = await createImageBitmap(imageFile);
const classifier = await pipeline('image-classification', 'umm-maybe/AI-image-detector');
const results = await classifier(imageBitmap);
document.getElementById('outputText').innerText = `Résultat : ${JSON.stringify(results, null, 2)}`;
});
</script>
Results in
Uncaught (in promise) Error: Could not locate file: "https://huggingface.co/umm-maybe/AI-image-detector/resolve/main/onnx/model_quantized.onnx".
Thank you!
Hi there, unfortunately I have had a bit of an adversarial relationship with JavaScript throughout my career, so I can't directly assist. But I approved the pull request to add an ONNX version of the checkpoint. Hopefully that helps!
umm-maybe changed discussion status to closed