File size: 620 Bytes
fdc3d49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import streamlit as st
from text_model import Models
import os

st.title("Story Teller")
model = Models()
st.write("Upload an image and get a story")
uploaded_file = st.file_uploader("Upload your file here...",type=['png','jpeg','jpg'])

try:
    if uploaded_file is not None:
        st.image(uploaded_file)
        with open(os.path.join("images",uploaded_file.name),"wb") as f: 
            f.write(uploaded_file.getbuffer()) 
        response = model.chain(model.img2text(f'images/{uploaded_file.name}'))
        st.write(response)
except Exception as e:
    print(e)
    st.write("error occured! please try again")