import os from ulti import * import threading import pipeline import streamlit as st from PIL import Image def main(): st.set_page_config(layout="wide") st.image(os.path.join('Images','Banner No2.png'), use_column_width = True) st.markdown("

Writing Vietnamese poem from image

", unsafe_allow_html=True) choice = 'Image Based' # Create the Home page if choice == 'Image Based': img_file_buffer = st.file_uploader('Upload your image here',type=['jpg','jpeg','png']) if img_file_buffer is not None: from PIL import Image col1, col2 = st.columns(2) image = Image.open(img_file_buffer).convert("RGB") #image = np.array(image) # image = adjust_gamma(image, gamma=gamma) with col1: st.image(image) poem = pipeline.main(image) print(poem) poem = poem.split(' [SEP] ')[-1].replace('\n', '
') with col2: st.markdown("

" + poem + "

", unsafe_allow_html=True) if __name__ == '__main__': main()