Spaces:
Runtime error
Runtime error
File size: 674 Bytes
9205986 03856d4 9205986 03856d4 9205986 03856d4 9205986 03856d4 9205986 03856d4 9205986 03856d4 9205986 03856d4 9205986 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import streamlit as st
import numpy as np
import torch
import torch.nn as nn
from PIL import Image
from model import model, image_transforms_gs, image_transforms_rgb
st.title("UNET Image Colorizer")
upload_file = st.file_uploader("Upload Image")
if upload_file:
image = upload_file
image_gs = upload_file
image = Image.open(image)
if len(np.array(image).shape) < 3:
image = image_transforms_gs(image)
else:
image = image_transforms_rgb(image)
image_color = model(image.unsqueeze(0)).squeeze().permute(1, 2, 0).detach().cpu().numpy()
col1, col2 = st.columns(2)
col1.image(image_gs)
col2.image(image_color, clamp=True, channels='RGB') |