Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -164,35 +164,32 @@ def main():
|
|
164 |
option = st.selectbox('Choose the voice you want', list(voice_options.keys()))
|
165 |
classify = voice_options[option]
|
166 |
|
167 |
-
# New: Duration selection dropdown
|
168 |
duration_options = list(range(10, 121, 10)) # 10 to 120 seconds, in 10 second intervals
|
169 |
selected_duration = st.selectbox('Select the desired video duration (seconds)', duration_options)
|
170 |
|
171 |
-
#
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
"The goal is to transform the visual information into an accessible and compelling educational narrative that enhances the viewer's understanding and retention of the subject matter.")
|
181 |
-
|
182 |
-
initial_prompt = dynamic_prompt_intro + static_prompt_body
|
183 |
|
184 |
-
#
|
185 |
-
|
|
|
|
|
186 |
|
187 |
if uploaded_file is not None and st.button("START PROCESSING", type="primary"):
|
188 |
with st.spinner("Video is being processed..."):
|
189 |
base64Frame, video_filename, video_duration = video_to_frames(uploaded_file, frame_sampling_rate=1)
|
190 |
|
191 |
-
if video_duration >
|
192 |
-
st.error("The video exceeds the
|
193 |
return
|
194 |
|
195 |
-
# No need to insert duration into prompt again since the user has already had the chance to edit it
|
196 |
text = frames_to_story(base64Frame, prompt, openai_key)
|
197 |
st.write(text)
|
198 |
|
|
|
164 |
option = st.selectbox('Choose the voice you want', list(voice_options.keys()))
|
165 |
classify = voice_options[option]
|
166 |
|
|
|
167 |
duration_options = list(range(10, 121, 10)) # 10 to 120 seconds, in 10 second intervals
|
168 |
selected_duration = st.selectbox('Select the desired video duration (seconds)', duration_options)
|
169 |
|
170 |
+
# New dropdown for script generator type
|
171 |
+
script_type_options = {
|
172 |
+
'Product Tutorial': 'Product Tutorial',
|
173 |
+
'TikTok': 'TikTok',
|
174 |
+
'YouTube Short': 'YouTube Short',
|
175 |
+
'Website Tutorial': 'Website Tutorial',
|
176 |
+
'General Info': 'General Info'
|
177 |
+
}
|
178 |
+
selected_script_type = st.selectbox('Choose the script generator type', list(script_type_options.keys()))
|
|
|
|
|
|
|
179 |
|
180 |
+
# Incorporating the selected script type and duration into the prompt
|
181 |
+
dynamic_prompt_intro = f"Script type: {selected_script_type}. Generate a voiceover script that is approximately {selected_duration} seconds long, tailored to the content and format of a {selected_script_type.lower()}."
|
182 |
+
|
183 |
+
prompt = st.text_area("Edit the voiceover script prompt as needed:", value=dynamic_prompt_intro, height=300)
|
184 |
|
185 |
if uploaded_file is not None and st.button("START PROCESSING", type="primary"):
|
186 |
with st.spinner("Video is being processed..."):
|
187 |
base64Frame, video_filename, video_duration = video_to_frames(uploaded_file, frame_sampling_rate=1)
|
188 |
|
189 |
+
if video_duration > selected_duration:
|
190 |
+
st.error(f"The video exceeds the selected duration of {selected_duration} seconds.")
|
191 |
return
|
192 |
|
|
|
193 |
text = frames_to_story(base64Frame, prompt, openai_key)
|
194 |
st.write(text)
|
195 |
|