import streamlit as st from footer import footer import pandas as pd from io import StringIO import os # Image from PIL import Image streamlit_style = """ """ st.markdown(streamlit_style, unsafe_allow_html=True) #@st.cache def load_image(image_file): img = Image.open(image_file) return img col1, col2, col3 = st.columns(3) with col1: st.write(' ') with col2: st.image("https://imgtr.ee/images/2023/04/24/8KrbX.png") with col3: st.write(' ') footer() st.markdown("
Plant the seed of your story with a picture.
", unsafe_allow_html=True) image_file = st.file_uploader("Upload An Image",type=['png','jpeg','jpg']) from model import get_story if image_file is not None: file_details = {"FileName":image_file.name,"FileType":image_file.type} img = load_image(image_file) st.image(img) img_path = os.path.join("tempDir",image_file.name) with open(img_path,"wb") as f: f.write(image_file.getbuffer()) with st.spinner("File uploaded. Writing Story.."): story = get_story(img_path) st.success("Here's your story.. 🎉") st.write(story)