Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,43 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: es
|
3 |
+
tags:
|
4 |
+
- pytorch
|
5 |
+
- image-classification
|
6 |
+
license: cc-by-nc-nd-4.0
|
7 |
+
pipeline_tag: image-classification
|
8 |
+
widget:
|
9 |
+
- src: "sample_image1.jpg"
|
10 |
+
example_title: "Ejemplo de Lesión 1"
|
11 |
+
- src: "sample_image2.jpg"
|
12 |
+
example_title: "Ejemplo de Lesión 2"
|
13 |
+
---
|
14 |
+
|
15 |
+
# SkinLesionDetector-Transformer
|
16 |
+
|
17 |
+
Este es un modelo de clasificación de lesiones en la piel basado en el modelo ViT de Google. Está diseñado para detectar y clasificar lesiones en imágenes de la piel.
|
18 |
+
|
19 |
+
## Uso
|
20 |
+
|
21 |
+
```python
|
22 |
+
from transformers import AutoImageProcessor, ViTForImageClassification
|
23 |
+
import torch
|
24 |
+
from PIL import Image
|
25 |
+
import requests
|
26 |
+
|
27 |
+
# Cargar el modelo y el procesador
|
28 |
+
model = ViTForImageClassification.from_pretrained("usuario/SkinLesionDetector-Transformer")
|
29 |
+
processor = AutoImageProcessor.from_pretrained("usuario/SkinLesionDetector-Transformer")
|
30 |
+
|
31 |
+
# Cargar una imagen de prueba
|
32 |
+
image_url = "URL_DE_LA_IMAGEN"
|
33 |
+
image = Image.open(requests.get(image_url, stream=True).raw)
|
34 |
+
|
35 |
+
# Preprocesar la imagen
|
36 |
+
inputs = processor(images=image, return_tensors="pt")
|
37 |
+
|
38 |
+
# Hacer la predicción
|
39 |
+
outputs = model(**inputs)
|
40 |
+
|
41 |
+
# Obtener la clase predicha
|
42 |
+
predicted_class = outputs.logits.argmax(-1).item()
|
43 |
+
print(f"La clase predicha es: {predicted_class}")
|