<jupyter_start><jupyter_text>Adaptive Style Transfer with AdaIN<jupyter_code>from ipywidgets import FloatSlider, Checkbox
from ipyfilechooser import FileChooser
from gui import *
import os<jupyter_output><empty_output><jupyter_text>Setup the Style Transfer<jupyter_code># Choose content file
content_fc = FileChooser('./input/content', title="Choose Your Image")
display(content_fc)

# Choose style file
style_fc = FileChooser('./input/style', title="Choose Your Style")
display(style_fc)

# Choose alpha
alpha_slider = FloatSlider(value=0.5, min=0, max=1.0, step=0.05, description='Alpha:', indent=False)
print("Higher alpha means more style, less content")
display(alpha_slider)

# Preserve color
preserve_box = Checkbox(value=False, description='Preserve Color', indent=False)
display(preserve_box)<jupyter_output><empty_output><jupyter_text>Run the Neural Network<jupyter_code>command = "python3 src/test.py --content {} --style {} --alpha {}".format(
    content_fc.selected,
    style_fc.selected,
    alpha_slider.value
)

if preserve_box.value:
    command += " --preserve_color"

print("Running style transfer...")
print("> " + command)
os.system(command)
print("Done")<jupyter_output>Running style transfer...
python3 src/test.py --content ./input/content/flowers.jpg --style ./input/style/antimonocromatismo.jpg --alpha 0.45 --preserve_color
Done<jupyter_text>See the Results<jupyter_code>result_path = get_result_path(content_fc.selected, style_fc.selected)
display_image(result_path)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12450851900393185, 'fraction_numerical': 0.00851900393184797, 'mean_word_length': 6.790816326530612, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '297416', 'license': 'MIT', 'n_tokens_mistral': 516, 'n_tokens_neox': 497, 'n_words': 104, 'path': 'style_gui.ipynb', 'repo_name': 'tobyshooters/style_gui', 'size': '1526'}