Spaces:
Sleeping
Sleeping
Commit
·
393fbcf
1
Parent(s):
968f312
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ from langchain import PromptTemplate
|
|
| 3 |
from langchain.llms import OpenAI
|
| 4 |
import math
|
| 5 |
|
| 6 |
-
|
| 7 |
# LLM loading function
|
| 8 |
def load_LLM(openai_api_key):
|
| 9 |
llm = OpenAI(openai_api_key=openai_api_key)
|
|
@@ -51,17 +50,81 @@ def generate_detailed_content(llm, content_input, video_length, video_style, ton
|
|
| 51 |
|
| 52 |
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
# Streamlit UI
|
| 55 |
st.set_page_config(page_title="ScriptMaven📜🧠", page_icon=":robot:")
|
| 56 |
-
st.header("
|
| 57 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
openai_api_key = st.text_input("OpenAI API Key", placeholder="Ex: sk-2twmA8tfCb8un4...")
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
# Generate plan button
|
|
@@ -79,4 +142,11 @@ if st.button("Generate Plan"):
|
|
| 79 |
detailed_content = generate_detailed_content(llm, content_plan, content_input, video_length, video_style, tone, content_type)
|
| 80 |
|
| 81 |
st.write("Generated Detailed Scripts:")
|
| 82 |
-
st.write(detailed_content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from langchain.llms import OpenAI
|
| 4 |
import math
|
| 5 |
|
|
|
|
| 6 |
# LLM loading function
|
| 7 |
def load_LLM(openai_api_key):
|
| 8 |
llm = OpenAI(openai_api_key=openai_api_key)
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
+
# ... Your existing functions
|
| 54 |
+
|
| 55 |
+
# Streamlit UI
|
| 56 |
+
|
| 57 |
# Streamlit UI
|
| 58 |
st.set_page_config(page_title="ScriptMaven📜🧠", page_icon=":robot:")
|
| 59 |
+
st.header("Script:red[Maven] 📜🧠")
|
| 60 |
+
st.subheader("Your Edu-Video Blueprint", divider='rainbow')
|
| 61 |
+
st.write("Automate and optimize your educational video scripting with ScriptMaven. Leveraging OpenAI's GPT-4, it transforms raw text into structured video scripts tailored for various audiences and styles.")
|
| 62 |
+
# Add the Side Panel
|
| 63 |
+
st.sidebar.header('Product Description')
|
| 64 |
+
st.sidebar.markdown("""
|
| 65 |
+
**Key Features:**
|
| 66 |
+
- Multiple video styles and tones.
|
| 67 |
+
- Adjustable video lengths.
|
| 68 |
+
- Varied content types.
|
| 69 |
+
""")
|
| 70 |
+
st.sidebar.header("Who's it for?")
|
| 71 |
+
st.sidebar.markdown("""
|
| 72 |
+
- Content Creators
|
| 73 |
+
- Corporate Trainers
|
| 74 |
+
- Educational Institutions
|
| 75 |
+
""")
|
| 76 |
+
|
| 77 |
+
st.sidebar.header('How to Use:')
|
| 78 |
+
st.sidebar.markdown("""
|
| 79 |
+
[Get your OpenAI API Key from here](https://platform.openai.com/signup)
|
| 80 |
+
1. **API Key**: Enter OpenAI API key.
|
| 81 |
+
2. **Style & Tone**: Select from options.
|
| 82 |
+
3. **Video Length & Type**: Choose.
|
| 83 |
+
4. **Raw Content**: Paste.
|
| 84 |
+
5. **Generate Plan**: Click.
|
| 85 |
+
6. **Review & Finalize**: Obtain the script.
|
| 86 |
+
""")
|
| 87 |
+
# icons
|
| 88 |
+
# Add Font Awesome CSS
|
| 89 |
+
st.markdown("""
|
| 90 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
| 91 |
+
""", unsafe_allow_html=True)
|
| 92 |
+
|
| 93 |
+
# ... Existing code for sidebar and Font Awesome inclusion
|
| 94 |
+
|
| 95 |
+
# Add social media icons at the bottom
|
| 96 |
+
st.sidebar.markdown('---') # Horizontal line for separation
|
| 97 |
+
st.sidebar.markdown("### Socials:")
|
| 98 |
+
st.sidebar.markdown("""
|
| 99 |
+
<div style="display: flex; flex-direction: row; align-items: center;">
|
| 100 |
+
<a href="https://github.com/pathakmukul" target="_blank" style="margin-right: 20px; text-decoration: none;">
|
| 101 |
+
<i class="fab fa-github fa-2x" style="color: white;"></i>
|
| 102 |
+
</a>
|
| 103 |
+
<a href="https://twitter.com/twitter" target="_blank" style="margin-right: 20px; text-decoration: none;">
|
| 104 |
+
<i class="fab fa-twitter fa-2x" style="color: inherit;"></i>
|
| 105 |
+
</a>
|
| 106 |
+
<a href="https://huggingface.co/broductmanager" target="_blank" style="font-size: 28px; text-decoration: none; color: inherit;">
|
| 107 |
+
🤗
|
| 108 |
+
</a>
|
| 109 |
+
</div>
|
| 110 |
+
""", unsafe_allow_html=True)
|
| 111 |
+
|
| 112 |
+
# f
|
| 113 |
+
# Create columns for the API Key input and the Get Key link
|
| 114 |
|
| 115 |
openai_api_key = st.text_input("OpenAI API Key", placeholder="Ex: sk-2twmA8tfCb8un4...")
|
| 116 |
+
# Create 2x2 grid for the select boxes
|
| 117 |
+
col1, col2 = st.columns(2)
|
| 118 |
+
with col1:
|
| 119 |
+
video_style = st.selectbox('Video Style:', ('YouTube', 'Corporate'))
|
| 120 |
+
video_length = st.selectbox('Video Length(minutes):', ('3','5', '10', '15'))
|
| 121 |
+
|
| 122 |
+
with col2:
|
| 123 |
+
tone = st.selectbox('Audience:', ('School Students', 'College Students', 'Employee', 'For Teens'))
|
| 124 |
+
content_type = st.selectbox('Content Type:', ('Case Study', 'Masterclass', 'Documentary', 'How-to Videos', 'Coding', 'Summary', 'Review'))
|
| 125 |
+
|
| 126 |
+
# Text area below the 2x2 grid
|
| 127 |
+
content_input = st.text_area("Content Input", placeholder="Your content deserves to be here 👑 ")
|
| 128 |
|
| 129 |
|
| 130 |
# Generate plan button
|
|
|
|
| 142 |
detailed_content = generate_detailed_content(llm, content_plan, content_input, video_length, video_style, tone, content_type)
|
| 143 |
|
| 144 |
st.write("Generated Detailed Scripts:")
|
| 145 |
+
st.write(detailed_content)
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
# Add footer
|
| 149 |
+
st.markdown(
|
| 150 |
+
"<div style='text-align: center;'>Made with <span style='color: red;'>♥</span> by Mukul.</div>",
|
| 151 |
+
unsafe_allow_html=True,
|
| 152 |
+
)
|