Created
April 16, 2023 08:21
-
-
Save AIAnytime/258af7b161dc2caf5cfab1161408c52a to your computer and use it in GitHub Desktop.
Deoldify Images Streamlit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
import fastai | |
from deoldify.visualize import * | |
def image_colorizer(url): | |
colorizer = get_image_colorizer(artistic=True) | |
source_url = url | |
render_factor = 35 | |
watermarked = True | |
if source_url is not None and source_url !='': | |
print(source_url) | |
image_path = colorizer.plot_transformed_image_from_url(url=source_url, render_factor=render_factor, compare=True, watermarked=watermarked) | |
print(image_path) | |
else: | |
print('Provide an image url and try again.') | |
return image_path | |
st.set_page_config(layout='wide') | |
st.title('Image Colorizer App') | |
input_text = st.text_input('Enter your URL') | |
if input_text is not None: | |
if st.button('Colorize'): | |
col1, col2 = st.columns([1,1]) | |
with col1: | |
st.info("Your image") | |
st.image(input_text) | |
with col2: | |
result = image_colorizer(input_text) | |
st.success("Your colorized Image") | |
st.image("result_images/image.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment