sergeipetrov commited on
Commit
52bddc6
0 Parent(s):

Duplicate from sergeipetrov/dat-x2-ie

Browse files
Files changed (4) hide show
  1. .gitattributes +35 -0
  2. README.md +22 -0
  3. handler.py +20 -0
  4. requirements.txt +1 -0
.gitattributes ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-to-image
4
+ - super-resolution
5
+ library_name: generic
6
+ ---
7
+
8
+ ## DAT-x2 for 🤗Inference endpoint deployment.
9
+
10
+
11
+ ### Expected payload:
12
+ Curl:
13
+ ```json
14
+ curl URL \
15
+ -X POST \
16
+ --data-binary @car.png \
17
+ -H "Content-Type: image/png"
18
+ ```
19
+ Python:
20
+ ```python
21
+ requests.post(ENDPOINT_URL, headers={"Content-Type": "image/png"}, data=open("car.png", 'rb').read()).json()
22
+ ```
handler.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from image_gen_aux import UpscaleWithModel
2
+ import numpy as np
3
+ from PIL import Image
4
+ from io import BytesIO
5
+ import base64
6
+
7
+
8
+ class EndpointHandler():
9
+ def __init__(self, path=""):
10
+ self.upscaler = UpscaleWithModel.from_pretrained("OzzyGT/DAT_X2").to("cuda")
11
+
12
+ def __call__(self, data):
13
+ img = data.pop("inputs", data)
14
+ output = self.upscaler(img, tiling=True, tile_width=768, tile_height=768, overlap=8)
15
+
16
+ buffered = BytesIO()
17
+ output.save(buffered, format="JPEG")
18
+ img_str = base64.b64encode(buffered.getvalue())
19
+
20
+ return img_str.decode()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ git+https://github.com/asomoza/image_gen_aux.git