upscaler / app.py
analist's picture
Update app.py
a4aeff4
raw
history blame
No virus
987 Bytes
import streamlit as st
from super_image import EdsrModel, ImageLoader
from PIL import Image
st.title('Take your picture to the next level')
def upscale(model_choice):
if model_choice == "EDSR":
model = EdsrModel.from_pretrained('eugenesiow/edsr-base', scale=choice)
else:
st.text('Not supported yet. Comeback soon for fun releases')
inputs = ImageLoader.load_image(image)
preds = model(inputs)
st.subheader('New image')
st.image(preds, cpation=f'Upscaled {choice} times image')
st.download_button('Download', preds)
col1, col2 = st.columns([3, 1])
preds = None
with col1:
file = st.file_uploader('Post your picture')
if file is not None:
image = Image.open(file)
st.image(image)
with col2:
choice = st.selectbox('Scale to', ['x2', 'x3', 'x4'])
model_choice = st.selectbox('Model', ['EDSR', 'PAN', 'CARN'])
st.button('Upscale', on_click=upscale(model_choice))
st.text(choice)