Spaces:
Runtime error
Runtime error
artelabsuper
commited on
Commit
•
4216279
1
Parent(s):
d8f83ab
images with info
Browse files- app.py +5 -4
- copy_and_transform_imgs.py +14 -0
- demo_imgs/ex1.png +0 -0
- demo_imgs/ex2.png +0 -0
- demo_imgs/ex3.png +0 -0
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from PIL import Image
|
3 |
import torchvision
|
4 |
from torchvision import transforms
|
@@ -64,12 +65,12 @@ iface = gr.Interface(
|
|
64 |
gr.inputs.Radio(MODELS_TYPE)
|
65 |
],
|
66 |
outputs=[
|
67 |
-
gr.Text(),
|
68 |
-
gr.Image(),
|
69 |
-
gr.Image()
|
70 |
],
|
71 |
examples=[
|
72 |
-
["demo_imgs/
|
73 |
],
|
74 |
title="Super Resolution and DTM Estimation",
|
75 |
description=f"This demo predict Super Resolution and (Super Resolution) DTM from a Grayscale image (if RGB we convert it, for demo reason input is scale to {scale_size}x{scale_size})."
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
from PIL import Image
|
4 |
import torchvision
|
5 |
from torchvision import transforms
|
|
|
65 |
gr.inputs.Radio(MODELS_TYPE)
|
66 |
],
|
67 |
outputs=[
|
68 |
+
gr.Text(label='Model info'),
|
69 |
+
gr.Image(label='Super Resolution'),
|
70 |
+
gr.Image(label='DTM')
|
71 |
],
|
72 |
examples=[
|
73 |
+
[f"demo_imgs/{name}", MODELS_TYPE[0]] for name in os.listdir('demo_imgs')
|
74 |
],
|
75 |
title="Super Resolution and DTM Estimation",
|
76 |
description=f"This demo predict Super Resolution and (Super Resolution) DTM from a Grayscale image (if RGB we convert it, for demo reason input is scale to {scale_size}x{scale_size})."
|
copy_and_transform_imgs.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from osgeo import gdal
|
2 |
+
import os
|
3 |
+
from PIL import Image
|
4 |
+
import numpy as np
|
5 |
+
|
6 |
+
path = '/home/super/datasets-nas/hirise_oxia_planum_test_tiles_thruth/'
|
7 |
+
|
8 |
+
for i, file_name in enumerate(os.listdir(path)[16:30]):
|
9 |
+
file_path = os.path.join(path, file_name)
|
10 |
+
x = gdal.Open(file_path)
|
11 |
+
x_array = x.ReadAsArray()
|
12 |
+
# print(x_array.shape)
|
13 |
+
pil_img = Image.fromarray(np.uint8(x_array), 'L')
|
14 |
+
pil_img.save(f'demo_imgs/{i}.png')
|
demo_imgs/ex1.png
ADDED
demo_imgs/ex2.png
ADDED
demo_imgs/ex3.png
ADDED