Rodrigo_Cobo
commited on
Commit
•
10c55f7
1
Parent(s):
73a5b44
fix jpeg error
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import gradio as gr
|
|
3 |
import cv2
|
4 |
import torch
|
5 |
import urllib.request
|
|
|
6 |
import matplotlib.pyplot as plt
|
7 |
from PIL import Image
|
8 |
|
@@ -46,11 +47,14 @@ def update(slider, img):
|
|
46 |
|
47 |
output = prediction.cpu().numpy()
|
48 |
|
|
|
|
|
|
|
49 |
#out_im = Image.fromarray(output)
|
50 |
-
|
51 |
|
52 |
#cv2.imwrite("temp/image_depth.jpeg", output)
|
53 |
-
plt.imsave("temp/image_depth.jpeg", output)
|
54 |
|
55 |
return f'temp/image_depth.jpeg'
|
56 |
|
|
|
3 |
import cv2
|
4 |
import torch
|
5 |
import urllib.request
|
6 |
+
import numpy as np
|
7 |
import matplotlib.pyplot as plt
|
8 |
from PIL import Image
|
9 |
|
|
|
47 |
|
48 |
output = prediction.cpu().numpy()
|
49 |
|
50 |
+
formatted = (output * 255 / np.max(output)).astype('uint8')
|
51 |
+
out_im = Image.fromarray(formatted)
|
52 |
+
|
53 |
#out_im = Image.fromarray(output)
|
54 |
+
out_im.save("temp/image_depth.jpeg", "JPEG")
|
55 |
|
56 |
#cv2.imwrite("temp/image_depth.jpeg", output)
|
57 |
+
#plt.imsave("temp/image_depth.jpeg", output)
|
58 |
|
59 |
return f'temp/image_depth.jpeg'
|
60 |
|