palitrajarshi commited on
Commit
b1900e5
β€’
1 Parent(s): c66af70

Upload app.py

Browse files
Files changed (1) hide show
  1. 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.....")