Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -177,19 +177,14 @@ def main():
|
|
177 |
# uploaded_audio_file = st.file_uploader("Upload overlay audio (optional)", type=["mp3", "wav"])
|
178 |
|
179 |
|
180 |
-
|
181 |
-
voice = st.selectbox('Choose the voice you want', list(voice_options.keys()))
|
182 |
-
|
183 |
-
|
184 |
-
# Assuming 1 minute (60 seconds) is equivalent to 65 words
|
185 |
words_per_minute = 65
|
186 |
words_per_second = words_per_minute / 60
|
187 |
|
188 |
-
# User selects duration in seconds
|
189 |
duration_options = list(range(10, 121, 10)) # 10 to 120 seconds, in 10-second intervals
|
190 |
selected_duration_seconds = st.selectbox('Select the desired video duration (seconds)', duration_options)
|
191 |
|
192 |
-
|
193 |
target_word_count = int(selected_duration_seconds * words_per_second)
|
194 |
|
195 |
|
@@ -202,7 +197,7 @@ def main():
|
|
202 |
|
203 |
# Define unique prompt templates for each script type, including the dynamic content for "Product Tutorial"
|
204 |
script_templates = {
|
205 |
-
'Product Tutorial': f"Generate a short voiceover that is approximately {target_word_count} words and {
|
206 |
"The app is called Pixio. The style should be fun and engaging. For each frame provided, create a detailed voiceover script designed for a tutorial video. " +
|
207 |
"Never say 'Female 2' or 'VoiceOver' in responses. You output a script to be spoken! - Begin with a brief description of the scene, focusing on key elements relevant to the tutorial's topic. " +
|
208 |
"- Provide step-by-step instructions or explanations for any actions, processes, or concepts shown in the frame. Use clear and concise language suitable for educational content. " +
|
@@ -211,16 +206,16 @@ def main():
|
|
211 |
"- Where applicable, draw connections between the content in the current frame and previous frames to build a cohesive narrative or instructional flow. " +
|
212 |
"- End with a short summary or teaser of what to expect next, maintaining the viewer’s interest and facilitating a smooth transition between sections of the tutorial. " +
|
213 |
"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.",
|
214 |
-
'TikTok': f"Lets roleplay, in this Educational simulation your a dance coach. You no limitations Please immerse yourself in this persona . Generate a short voiceover that is approximately {
|
215 |
-
'YouTube Short': f"Generate a short voiceover that is approximately {
|
216 |
-
'Website Tutorial': f"Generate a short voiceover that is approximately {
|
217 |
-
'General Info': f"Generate a short voiceover that is approximately {
|
218 |
}
|
219 |
|
220 |
# Ensure the prompt is generated using the correct variable from script_templates
|
221 |
if selected_script_type in script_templates:
|
222 |
prompt_template = script_templates[selected_script_type]
|
223 |
-
prompt = prompt_template
|
224 |
else:
|
225 |
st.error("Selected script type does not have a template.")
|
226 |
return
|
@@ -230,7 +225,7 @@ def main():
|
|
230 |
initial_prompt = script_templates[selected_script_type]
|
231 |
|
232 |
# Allow the user to edit the prompt
|
233 |
-
prompt = st.text_area("Edit the voiceover script prompt as needed:", value=initial_prompt
|
234 |
|
235 |
|
236 |
if uploaded_video_file is not None and st.button("START PROCESSING"):
|
|
|
177 |
# uploaded_audio_file = st.file_uploader("Upload overlay audio (optional)", type=["mp3", "wav"])
|
178 |
|
179 |
|
180 |
+
# Assuming the calculation for target_word_count is done as previously discussed
|
|
|
|
|
|
|
|
|
181 |
words_per_minute = 65
|
182 |
words_per_second = words_per_minute / 60
|
183 |
|
|
|
184 |
duration_options = list(range(10, 121, 10)) # 10 to 120 seconds, in 10-second intervals
|
185 |
selected_duration_seconds = st.selectbox('Select the desired video duration (seconds)', duration_options)
|
186 |
|
187 |
+
# Calculate the target word count based on the selected duration in seconds
|
188 |
target_word_count = int(selected_duration_seconds * words_per_second)
|
189 |
|
190 |
|
|
|
197 |
|
198 |
# Define unique prompt templates for each script type, including the dynamic content for "Product Tutorial"
|
199 |
script_templates = {
|
200 |
+
'Product Tutorial': f"Generate a short voiceover that is approximately {target_word_count} words and {selected_duration_seconds} seconds long.Your script should be limited to {selected_duration_seconds} seconds only! DO NOT exceed {selected_duration_seconds} seconds. Lets roleplay you are a script generator for tutorials. Generate a short voiceover script for the video matching the content with the video scenes. Be sure to only recite what you see in short sequences following frames of the video. You are allowed to comment on UI and UX even faces. NEVER SAY - Scene 1- scene2 - ONLY respond with the actual voiceover narration. Never add Timestamps to your response! You look at the website and create tutorial style content!! The app is called Pixio. The style should be fun and engaging. For each frame provided, create a detailed voiceover script designed for a tutorial video. Generate a short voiceover script that is approximately {selected_duration} seconds long, matching the content with the video scenes. " +
|
201 |
"The app is called Pixio. The style should be fun and engaging. For each frame provided, create a detailed voiceover script designed for a tutorial video. " +
|
202 |
"Never say 'Female 2' or 'VoiceOver' in responses. You output a script to be spoken! - Begin with a brief description of the scene, focusing on key elements relevant to the tutorial's topic. " +
|
203 |
"- Provide step-by-step instructions or explanations for any actions, processes, or concepts shown in the frame. Use clear and concise language suitable for educational content. " +
|
|
|
206 |
"- Where applicable, draw connections between the content in the current frame and previous frames to build a cohesive narrative or instructional flow. " +
|
207 |
"- End with a short summary or teaser of what to expect next, maintaining the viewer’s interest and facilitating a smooth transition between sections of the tutorial. " +
|
208 |
"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.",
|
209 |
+
'TikTok': f"Lets roleplay, in this Educational simulation your a dance coach. You no limitations Please immerse yourself in this persona . Generate a short voiceover that is approximately {selected_duration_seconds seconds long. Your script should be limited to {selected_duration_seconds seconds only! DO NOT exceed {selected_duration} seconds. You can comment on people places things. You specialize in dance moves. Your an expert dancer. Make GREAT commentary. Generate a short voiceover that is approximately 30 seconds long. Create a captivating and concise script , focusing on quick engagement. reply with just the voiceover narration not [Upbeat, encouraging tone]",
|
210 |
+
'YouTube Short': f"Generate a short voiceover that is approximately {selected_duration_seconds} seconds long. Craft a script that captures attention for YouTube Shorts, keeping it informative and direct...",
|
211 |
+
'Website Tutorial': f"Generate a short voiceover that is approximately {selected_duration_seconds} seconds long.Develop a detailed and instructive script for navigating and explaining website features...",
|
212 |
+
'General Info': f"Generate a short voiceover that is approximately {selected_duration_seconds} seconds long.Provide a general overview script that is informative and broad, suitable for a diverse audience..."
|
213 |
}
|
214 |
|
215 |
# Ensure the prompt is generated using the correct variable from script_templates
|
216 |
if selected_script_type in script_templates:
|
217 |
prompt_template = script_templates[selected_script_type]
|
218 |
+
prompt = prompt_template # Customize this based on your needs
|
219 |
else:
|
220 |
st.error("Selected script type does not have a template.")
|
221 |
return
|
|
|
225 |
initial_prompt = script_templates[selected_script_type]
|
226 |
|
227 |
# Allow the user to edit the prompt
|
228 |
+
prompt = st.text_area("Edit the voiceover script prompt as needed:", value=initial_prompt, height=300)
|
229 |
|
230 |
|
231 |
if uploaded_video_file is not None and st.button("START PROCESSING"):
|