Spaces:
Sleeping
Sleeping
palitrajarshi
commited on
Commit
β’
b1900e5
1
Parent(s):
c66af70
Upload app.py
Browse files- pages/app.py +69 -0
pages/app.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from utils import generate_script
|
3 |
+
|
4 |
+
# Applying Styling
|
5 |
+
st.markdown("""
|
6 |
+
<style>
|
7 |
+
div.stButton > button:first-child {
|
8 |
+
background-color: #0099ff;
|
9 |
+
color:#ffffff;
|
10 |
+
}
|
11 |
+
div.stButton > button:hover {
|
12 |
+
background-color: #00ff00;
|
13 |
+
color:#FFFFFF;
|
14 |
+
}
|
15 |
+
</style>""", unsafe_allow_html=True)
|
16 |
+
|
17 |
+
|
18 |
+
# Creating Session State Variable
|
19 |
+
if 'API_Key' not in st.session_state:
|
20 |
+
st.session_state['API_Key'] =''
|
21 |
+
|
22 |
+
|
23 |
+
st.title('βοΈ All-in-One Script Writing Tool')
|
24 |
+
st.subheader("Be it for YouTube Video, Podcast, Reel or Webinar ποΈπ₯")
|
25 |
+
|
26 |
+
# Sidebar to capture the OpenAi API key
|
27 |
+
st.sidebar.title("πποΈ")
|
28 |
+
st.session_state['API_Key']= st.sidebar.text_input("What's your API key?",type="password")
|
29 |
+
st.sidebar.image('./video2.png',width=300, use_column_width=True)
|
30 |
+
|
31 |
+
|
32 |
+
# Captures User Inputs
|
33 |
+
prompt = st.text_input('Please provide the topic of the video',key="prompt") # The box for the text prompt
|
34 |
+
video_length = st.text_input('Expected Video Length π (in minutes)',key="video_length") # The box for the text prompt
|
35 |
+
creativity = st.slider('Creativity Meter β¨ - (0 LOW || 1 HIGH)', 0.0, 1.0, 0.2,step=0.1)
|
36 |
+
|
37 |
+
tasktype = st.radio(
|
38 |
+
'What do you need the Script for?',
|
39 |
+
('Podcasts', 'YouTube', 'Webinar', 'Reels'),key="task")
|
40 |
+
|
41 |
+
submit = st.button("Generate Script for me")
|
42 |
+
|
43 |
+
|
44 |
+
if submit:
|
45 |
+
|
46 |
+
with st.spinner('Wait for it...'):
|
47 |
+
|
48 |
+
if st.session_state['API_Key']:
|
49 |
+
search_result,title,script = generate_script(prompt,video_length,creativity,tasktype,st.session_state['API_Key'])
|
50 |
+
#Let's generate the script
|
51 |
+
st.success('Hope you like this script β€οΈ')
|
52 |
+
|
53 |
+
#Introducing a line separator
|
54 |
+
st.write(":heavy_minus_sign:" * 30)
|
55 |
+
|
56 |
+
#Display Title
|
57 |
+
st.subheader("Title:π₯")
|
58 |
+
st.write(title)
|
59 |
+
|
60 |
+
#Display Video Script
|
61 |
+
st.subheader("Your Script:π")
|
62 |
+
st.write(script)
|
63 |
+
|
64 |
+
#Display Search Engine Result
|
65 |
+
st.subheader("Check Out - DuckDuckGo Search:π")
|
66 |
+
with st.expander('Show me π'):
|
67 |
+
st.info(search_result)
|
68 |
+
else:
|
69 |
+
st.error("Ooopssss!!! Please provide API key.....")
|