Owos commited on
Commit
8aaffa8
·
1 Parent(s): 581326e

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -1,10 +1,13 @@
1
  import neural_style
2
 
3
  import streamlit as st
 
 
4
  import numpy as np
5
  #import cv2
6
  from PIL import Image, ImageEnhance
7
 
 
8
  #Create two columns with different width
9
  col1, col2 = st.columns( [0.8, 0.2])
10
  with col1: # To display the header text using css style
@@ -42,7 +45,11 @@ if uploaded_file is not None:
42
  params.backend = "mkl"
43
  params.image_size = 128
44
  params.content_image = uploaded_file
45
- neural_style.transfer(params)
 
 
 
 
46
 
47
  #display image when done.
48
  with col2:
 
1
  import neural_style
2
 
3
  import streamlit as st
4
+ import os
5
+ import random
6
  import numpy as np
7
  #import cv2
8
  from PIL import Image, ImageEnhance
9
 
10
+ st.set_page_config(layout="wide")
11
  #Create two columns with different width
12
  col1, col2 = st.columns( [0.8, 0.2])
13
  with col1: # To display the header text using css style
 
45
  params.backend = "mkl"
46
  params.image_size = 128
47
  params.content_image = uploaded_file
48
+ path = 'style'
49
+ styles = os.listdir(path)
50
+ params.style_image = random.choice(styles)
51
+ with st.spinner('Wait for it...'):
52
+ neural_style.transfer(params)
53
 
54
  #display image when done.
55
  with col2: