File size: 1,700 Bytes
2ca9cf5
8cad421
2ca9cf5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5af2921
2ca9cf5
 
 
 
 
 
 
 
 
 
c811aff
2ca9cf5
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import streamlit as st
from utils import generate_logline

# Applying Styling
st.markdown("""
<style>
div.stButton > button:first-child {
    background-color: #0a99fa;
    color:#ffffff;
}
div.stButton > button:hover {
    background-color: #ffffff;
    color:#0a99fa;
    }
</style>""", unsafe_allow_html=True)

# Creating Session State Variable
if 'API_Key' not in st.session_state:
    st.session_state['API_Key'] = ''

st.title('📝 Logline Creator')

# Sidebar to capture the OpenAi API key
st.sidebar.title("🗝️")
st.session_state['API_Key'] = st.sidebar.text_input("Paste in your OPENAI API key?", type="password")
st.sidebar.markdown('Logline Generator: Input a brief story description, select creativity and receive a story title and logline in return. Designed for my cloud Meetup as a demonstration of simple chaining using LangChain.  Check out our Cloud Meetup at https://www.meetup.com/florence-aws-user-group-meetup  It is free to join!')

# Captures User Inputs
prompt = st.text_input('Please provide a short description of your story', key="prompt")
creativity = st.slider('Creativity ✨ - (0 LOW || 1 HIGH)', 0.0, 1.0, 0.5, step=0.1)

submit = st.button("Generate a Logline for me")

if submit:

    if st.session_state['API_Key']:
        title, logline = generate_logline(prompt, creativity, st.session_state['API_Key'])
        # Let's generate the script
        st.success('Enjoy the Logline️')

        # Display Title
        st.subheader("Title:🔍")
        st.write(title)

        # Display Video Script
        st.subheader("Your Logline:🔥")
        st.write(logline)

    else:
        st.error("Please provide your OpenAI API key in the left column.....")