Spaces:
Sleeping
Sleeping
import streamlit as st | |
from utils2 import generate_script | |
langchain.verbose = False | |
# Applying Styling | |
st.markdown(""" | |
<style> | |
div.stButton > button:first-child { | |
background-color: #0099ff; | |
color:#ffffff; | |
} | |
div.stButton > button:hover { | |
background-color: #00ff00; | |
color:#FFFFFF; | |
} | |
</style>""", unsafe_allow_html=True) | |
# Creating Session State Variable | |
if 'API_Key' not in st.session_state: | |
st.session_state['API_Key'] ='' | |
st.title('βοΈ All-in-One Script Writing Tool') | |
st.subheader("Be it for YouTube Video, Podcast, Reel or Webinar ποΈπ₯") | |
# Sidebar to capture the OpenAi API key | |
st.sidebar.title("πποΈ") | |
st.session_state['API_Key']= st.sidebar.text_input("What's your API key?",type="password") | |
st.sidebar.image('./video2.png',width=300, use_column_width=True) | |
# Captures User Inputs | |
prompt = st.text_input('Please provide the topic of the video',key="prompt") # The box for the text prompt | |
video_length = st.text_input('Expected Video Length π (in minutes)',key="video_length") # The box for the text prompt | |
creativity = st.slider('Creativity Meter β¨ - (0 LOW || 1 HIGH)', 0.0, 1.0, 0.2,step=0.1) | |
tasktype = st.radio( | |
'What do you need the Script for?', | |
('Podcasts', 'YouTube', 'Webinar', 'Reels'),key="task") | |
submit = st.button("Generate Script for me") | |
if submit: | |
with st.spinner('Wait for it...'): | |
if st.session_state['API_Key']: | |
search_result,title,script = generate_script(prompt,video_length,creativity,tasktype,st.session_state['API_Key']) | |
#Let's generate the script | |
st.success('Hope you like this script β€οΈ') | |
#Introducing a line separator | |
st.write(":heavy_minus_sign:" * 30) | |
#Display Title | |
st.subheader("Title:π₯") | |
st.write(title) | |
#Display Video Script | |
st.subheader("Your Script:π") | |
st.write(script) | |
#Display Search Engine Result | |
st.subheader("Check Out - DuckDuckGo Search:π") | |
with st.expander('Show me π'): | |
st.info(search_result) | |
else: | |
st.error("Ooopssss!!! Please provide API key.....") |