Spaces:
Sleeping
Sleeping
File size: 1,956 Bytes
76b272b |
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 51 52 53 54 55 56 57 58 59 60 61 62 |
import streamlit as st
from utils import generate_script
import os
os.environ["HUGGINGFACEHUB_API_TOKEN"] = "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"
# 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 'HUGGINGFACEHUB_API_TOKEN' not in st.session_state:
st.session_state['HUGGINGFACEHUB_API_TOKEN'] =''
st.title('β€οΈ YouTube Script Writing Tool')
# Sidebar to capture the OpenAi API key
st.sidebar.title("πποΈ")
st.session_state['HUGGINGFACEHUB_API_TOKEN']= st.sidebar.text_input("What's your API key?",type="password")
st.sidebar.image('./Youtube.jpg',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('Words limit β¨ - (0 LOW || 1 HIGH)', 0.0, 1.0, 0.2,step=0.1)
submit = st.button("Generate Script for me")
if submit:
if st.session_state['HUGGINGFACEHUB_API_TOKEN']:
search_result,title,script = generate_script(prompt,video_length,creativity,st.session_state['HUGGINGFACEHUB_API_TOKEN'])
#Let's generate the script
st.success('Hope you like this script β€οΈ')
#Display Title
st.subheader("Title:π₯")
st.write(title)
#Display Video Script
st.subheader("Your Video 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.....") |