Update README.md
Browse files
README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
---
|
2 |
license: mit
|
3 |
library_name: transformers
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
# MangaLineExtraction-hf
|
@@ -11,7 +14,29 @@ Original repo: https://github.com/ljsabc/MangaLineExtraction_PyTorch
|
|
11 |
|
12 |
## Example
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
## Model Details
|
17 |
|
@@ -44,4 +69,4 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
44 |
number = {4},
|
45 |
pages = {117:1--117:12},
|
46 |
}
|
47 |
-
```
|
|
|
1 |
---
|
2 |
license: mit
|
3 |
library_name: transformers
|
4 |
+
tags:
|
5 |
+
- image-to-image
|
6 |
+
- lineart
|
7 |
---
|
8 |
|
9 |
# MangaLineExtraction-hf
|
|
|
14 |
|
15 |
## Example
|
16 |
|
17 |
+
|
18 |
+
```py
|
19 |
+
from PIL import Image
|
20 |
+
import torch
|
21 |
+
|
22 |
+
from transformers import AutoModel, AutoImageProcessor
|
23 |
+
|
24 |
+
REPO_NAME = "p1atdev/MangaLineExtraction-hf"
|
25 |
+
|
26 |
+
model = AutoModel.from_pretrained(REPO_NAME, trust_remote_code=True)
|
27 |
+
processor = AutoImageProcessor.from_pretrained(REPO_NAME, trust_remote_code=True)
|
28 |
+
|
29 |
+
image = Image.open("./sample.jpg")
|
30 |
+
|
31 |
+
inputs = processor(image, return_tensors="pt")
|
32 |
+
|
33 |
+
with torch.no_grad():
|
34 |
+
outputs = model(inputs.pixel_values)
|
35 |
+
|
36 |
+
line_image = Image.fromarray(outputs.pixel_values[0].numpy().astype("uint8"), mode="L")
|
37 |
+
line_image.save("./line_image.png")
|
38 |
+
```
|
39 |
+
|
40 |
|
41 |
## Model Details
|
42 |
|
|
|
69 |
number = {4},
|
70 |
pages = {117:1--117:12},
|
71 |
}
|
72 |
+
```
|