Commit ·
e0c07aa
1
Parent(s): 1348930
Update pages/03_🖼️_Input_Images.py
Browse files- pages/03_🖼️_Input_Images.py +6 -25
pages/03_🖼️_Input_Images.py
CHANGED
|
@@ -1,39 +1,20 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from streamlit_lottie import st_lottie
|
| 3 |
-
from models.deep_colorization.colorizers import eccv16, siggraph17
|
| 4 |
-
from utils import colorize_image
|
| 5 |
-
import requests
|
| 6 |
import os
|
| 7 |
import zipfile
|
| 8 |
-
from PIL import Image
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
|
| 14 |
-
def load_lottieurl(url: str):
|
| 15 |
-
r = requests.get(url)
|
| 16 |
-
if r.status_code != 200:
|
| 17 |
-
return None
|
| 18 |
-
return r.json()
|
| 19 |
|
| 20 |
|
| 21 |
loaded_model = eccv16(pretrained=True).eval()
|
| 22 |
current_model = "None"
|
| 23 |
|
| 24 |
|
| 25 |
-
@st.cache_resource()
|
| 26 |
-
def change_model(current_model, model):
|
| 27 |
-
if current_model != model:
|
| 28 |
-
if model == "ECCV16":
|
| 29 |
-
loaded_model = eccv16(pretrained=True).eval()
|
| 30 |
-
elif model == "SIGGRAPH17":
|
| 31 |
-
loaded_model = siggraph17(pretrained=True).eval()
|
| 32 |
-
return loaded_model
|
| 33 |
-
else:
|
| 34 |
-
raise Exception("Model is the same as the current one.")
|
| 35 |
-
|
| 36 |
-
|
| 37 |
col1, col2 = st.columns([1, 3])
|
| 38 |
with col1:
|
| 39 |
lottie = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_RHdEuzVfEL.json")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import zipfile
|
|
|
|
| 3 |
|
| 4 |
+
import streamlit as st
|
| 5 |
+
from PIL import Image
|
| 6 |
+
from streamlit_lottie import st_lottie
|
| 7 |
|
| 8 |
+
from models.deep_colorization.colorizers import eccv16
|
| 9 |
+
from utils import colorize_image, change_model, load_lottieurl
|
| 10 |
|
| 11 |
+
st.set_page_config(page_title="Image & Video Colorizer", page_icon="🎨", layout="wide")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
loaded_model = eccv16(pretrained=True).eval()
|
| 15 |
current_model = "None"
|
| 16 |
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
col1, col2 = st.columns([1, 3])
|
| 19 |
with col1:
|
| 20 |
lottie = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_RHdEuzVfEL.json")
|