umuthopeyildirim
commited on
Commit
•
3034d2d
1
Parent(s):
f92af9d
Refactor image loading in app.py
Browse files
app.py
CHANGED
@@ -78,7 +78,7 @@ with gr.Blocks(css=css) as demo:
|
|
78 |
# image = transform({'image': image})['image']
|
79 |
# image = torch.from_numpy(image).unsqueeze(0).to(DEVICE)
|
80 |
|
81 |
-
image = np.asarray(
|
82 |
image = torch.from_numpy(image.transpose((2, 0, 1)))
|
83 |
image = Normalize(mean=[0.485, 0.456, 0.406], std=[
|
84 |
0.229, 0.224, 0.225])(image)
|
|
|
78 |
# image = transform({'image': image})['image']
|
79 |
# image = torch.from_numpy(image).unsqueeze(0).to(DEVICE)
|
80 |
|
81 |
+
image = np.asarray(image, dtype=np.float32) / 255.0
|
82 |
image = torch.from_numpy(image.transpose((2, 0, 1)))
|
83 |
image = Normalize(mean=[0.485, 0.456, 0.406], std=[
|
84 |
0.229, 0.224, 0.225])(image)
|