Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,17 +50,17 @@ if not PEXELS_API_KEY:
|
|
| 50 |
if not OPENROUTER_API_KEY:
|
| 51 |
OPENROUTER_API_KEY = 'YOUR_OPENROUTER_KEY_HERE' # Replace with your key for local testing
|
| 52 |
|
| 53 |
-
OPENROUTER_MODEL = "
|
| 54 |
OUTPUT_VIDEO_FILENAME = "final_video.mp4"
|
| 55 |
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
| 56 |
|
| 57 |
# Global variables for Gradio interface
|
| 58 |
-
selected_voice = '
|
| 59 |
-
voice_speed = 1
|
| 60 |
font_size = 45 # Default font size
|
| 61 |
-
video_clip_probability = 0.
|
| 62 |
bg_music_volume = 0.08 # Default background music volume
|
| 63 |
-
fps =
|
| 64 |
preset = "veryfast" # Default preset
|
| 65 |
TARGET_RESOLUTION = None
|
| 66 |
CAPTION_COLOR = None
|
|
@@ -116,47 +116,40 @@ def generate_script(user_input):
|
|
| 116 |
'X-Title': 'AI Documentary Maker'
|
| 117 |
}
|
| 118 |
|
| 119 |
-
prompt = f"""You're a
|
| 120 |
|
| 121 |
-
The script should sound like a real
|
| 122 |
|
| 123 |
Structure:
|
| 124 |
-
- Break the script into scenes using [Tags]. Each tag is a short title (1β2 words) that describes the visual or idea.
|
| 125 |
-
- Under each tag, write one sentence (max 12 words) that fits the tag and continues the topic.
|
| 126 |
-
- The full script should make sense as one connected narration β no randomness.
|
| 127 |
-
- Use natural, formal English. No slang, no fake AI language, and no robotic tone.
|
| 128 |
-
- Do not use humor, sarcasm, or casual language. This is a serious narration.
|
| 129 |
-
- No emotion-sound words like "aww," "eww," "whoa," etc.
|
| 130 |
-
- Do not use numbers like 1, 2, 3 β write them out as one, two, three.
|
| 131 |
-
- At the end, add a [Subscribe] tag with a formal or respectful reason to follow or subscribe.
|
| 132 |
|
| 133 |
-
|
| 134 |
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
[Ocean]
|
| 138 |
|
| 139 |
-
The
|
| 140 |
|
| 141 |
-
|
| 142 |
|
| 143 |
-
|
| 144 |
|
| 145 |
-
[
|
| 146 |
|
| 147 |
-
|
| 148 |
|
| 149 |
-
[
|
|
|
|
| 150 |
|
| 151 |
-
|
|
|
|
| 152 |
|
| 153 |
-
[
|
|
|
|
| 154 |
|
| 155 |
-
|
|
|
|
| 156 |
|
| 157 |
[Subscribe]
|
| 158 |
-
|
| 159 |
-
Follow to explore more about the changing planet we live on.
|
| 160 |
|
| 161 |
Now here is the Topic/script: {user_input}
|
| 162 |
"""
|
|
|
|
| 50 |
if not OPENROUTER_API_KEY:
|
| 51 |
OPENROUTER_API_KEY = 'YOUR_OPENROUTER_KEY_HERE' # Replace with your key for local testing
|
| 52 |
|
| 53 |
+
OPENROUTER_MODEL = "x-ai/grok-4-fast:free"
|
| 54 |
OUTPUT_VIDEO_FILENAME = "final_video.mp4"
|
| 55 |
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
|
| 56 |
|
| 57 |
# Global variables for Gradio interface
|
| 58 |
+
selected_voice = 'am_michael' # Default voice
|
| 59 |
+
voice_speed = 1 # Default voice speed (changed from 0.9 to 1.2 to match slider default)
|
| 60 |
font_size = 45 # Default font size
|
| 61 |
+
video_clip_probability = 0.65 # Default probability for video clips
|
| 62 |
bg_music_volume = 0.08 # Default background music volume
|
| 63 |
+
fps = 24 # Default FPS
|
| 64 |
preset = "veryfast" # Default preset
|
| 65 |
TARGET_RESOLUTION = None
|
| 66 |
CAPTION_COLOR = None
|
|
|
|
| 116 |
'X-Title': 'AI Documentary Maker'
|
| 117 |
}
|
| 118 |
|
| 119 |
+
prompt = f"""You're a comedic documentary narrator. Your job is to write a funny, witty, and unpredictable video script based on one topic.
|
| 120 |
|
| 121 |
+
The script should sound like a real voiceover parody β playful, sarcastic, and filled with surprising jokes, while still slipping in actual information when needed. Think of it as National Geographic meets stand-up comedy.
|
| 122 |
|
| 123 |
Structure:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
+
Break the script into scenes using [Tags]. Each tag is a short title (1β2 words) that sets up the joke or idea.
|
| 126 |
|
| 127 |
+
Under each tag, write one short sentence (max 12 words) that fits the tag and continues the story.
|
|
|
|
|
|
|
| 128 |
|
| 129 |
+
The full script should connect loosely but be intentionally unpredictable and silly.
|
| 130 |
|
| 131 |
+
Use absurd comparisons, unexpected punchlines, and exaggerations.
|
| 132 |
|
| 133 |
+
The humor should never break character: it should always sound like a narrator, not like a random list of jokes.
|
| 134 |
|
| 135 |
+
End with a [Subscribe] tag that gives a ridiculous, over-the-top reason to follow or subscribe.
|
| 136 |
|
| 137 |
+
Example:
|
| 138 |
|
| 139 |
+
[Penguins]
|
| 140 |
+
Penguins waddle like overdressed businessmen late for a meeting.
|
| 141 |
|
| 142 |
+
[Fish]
|
| 143 |
+
Their diet is mostly fish, which explains the constant fish breath.
|
| 144 |
|
| 145 |
+
[Predators]
|
| 146 |
+
Leopard seals see penguins as bite-sized appetizers wearing tuxedos.
|
| 147 |
|
| 148 |
+
[Humans]
|
| 149 |
+
Tourists watch penguins while holding cameras worth more than a penguin's house.
|
| 150 |
|
| 151 |
[Subscribe]
|
| 152 |
+
Subscribe, or a penguin will steal your sandwich in broad daylight.
|
|
|
|
| 153 |
|
| 154 |
Now here is the Topic/script: {user_input}
|
| 155 |
"""
|