Spaces:
s
Configuration error

s
File size: 29,106 Bytes
0ff5bc0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "zC32SDJxrOsM",
        "cellView": "form"
      },
      "outputs": [],
      "source": [
        "#@markdown <center><h3><h2>ShortGPT</h2>Install Requirements. This is 1 Click Run App to create Short Videos</h3></center><br>\n",
        "# 📦 Install ImageMagick and ffmpeg\n",
        "!sudo apt-get install imagemagick\n",
        "!sudo apt-get install ffmpeg\n",
        "\n",
        "# 📝 Fix Imagemagick policy.xml bug in linux using MoviePy\n",
        "!sed -i '/<policy domain=\"path\" rights=\"none\" pattern=\"@\\*\"/d' /etc/ImageMagick-6/policy.xml\n",
        "\n",
        "import os\n",
        "if not os.path.exists('/content/ShortGPT'):\n",
        "  # 📂 Clone the ShortGPT repository\n",
        "  !git clone https://github.com/enterprisium/ShortGPT.git\n",
        "  %cd /content/ShortGPT/\n",
        "else:\n",
        "  %cd /content/ShortGPT/\n",
        "  # If the directory already exists, just pull the latest version\n",
        "  !git pull\n",
        "# 🚀 Change directory to ShortGPT\n",
        "\n",
        "# 🛠️ Install required Python packages\n",
        "!pip install -r requirements.txt"
      ]
    },
    {
      "cell_type": "code",
      "source": [
        "# Import necessary modules from ShortGPT\n",
        "from shortGPT.config.api_db import ApiKeyManager, ApiProvider\n",
        "from shortGPT.config.asset_db import AssetDatabase, AssetType\n",
        "from shortGPT.engine.facts_short_engine import FactsShortEngine\n",
        "from shortGPT.audio.edge_voice_module import EdgeTTSVoiceModule\n",
        "from shortGPT.audio.coqui_voice_module import CoquiVoiceModule\n",
        "from shortGPT.audio.eleven_voice_module import ElevenLabsVoiceModule  # Add this line to import ElevenLabsVoiceModule\n",
        "from shortGPT.config.languages import Language, EDGE_TTS_VOICENAME_MAPPING\n",
        "from shortGPT.config.languages import LANGUAGE_ACRONYM_MAPPING, Language\n",
        "import random\n",
        "\n",
        "# Load API keys from environment variables or hardcoded values\n",
        "OPENAI_API = \"\"  # @param {type:\"string\"}\n",
        "ELEVEN_LABS_API = \"\"  # @param {type:\"string\"}\n",
        "PEXELS_API = \"\"  # @param {type:\"string\"}\n",
        "\n",
        "# Configuration parameters\n",
        "NUM_OF_SHORTS = 1  # @param {type:\"integer\"}\n",
        "TYPE_OF_SHORTS = \"Astrophotography and Space Facts: Combine stunning visuals of the night sky with fascinating space facts, catering to the curiosity of viewers interested in astronomy.\"  # @param {type:\"string\"}\n",
        "TTS_ENGINE = \"ElevenLabs\"  # @param [\"Edge TTS\", \"ElevenLabs\", \"Coqui TTS\"]\n",
        "LANGUAGE = \"English\"  # @param [\"English\", \"Spanish\", \"French\", \"Arabic\", \"German\", \"Polish\", \"Italian\", \"Portuguese\", \"Afrikaans\", \"Amharic\", \"Azerbaijani\", \"Bulgarian\", \"Bengali\", \"Bosnian\", \"Catalan\", \"Czech\", \"Welsh\", \"Danish\", \"Greek\", \"Estonian\", \"Persian\", \"Finnish\", \"Filipino\", \"Galician\", \"Gujarati\", \"Hebrew\", \"Hindi\", \"Croatian\", \"Hungarian\", \"Indonesian\", \"Icelandic\", \"Japanese\", \"Javanese\", \"Georgian\", \"Kazakh\", \"Khmer\", \"Kannada\", \"Korean\", \"Lao\", \"Lithuanian\", \"Latvian\", \"Macedonian\", \"Malayalam\", \"Mongolian\", \"Marathi\", \"Malay\", \"Maltese\", \"Myanmar\", \"Norwegian\", \"Nepali\", \"Dutch\", \"Norwegian Bokmål\", \"Norwegian Nynorsk\", \"Pashto\", \"Romanian\", \"Russian\", \"Sinhala\", \"Slovak\", \"Slovenian\", \"Somali\", \"Albanian\", \"Serbian\", \"Sundanese\", \"Swedish\", \"Swahili\", \"Tamil\", \"Telugu\", \"Thai\", \"Turkish\", \"Ukrainian\", \"Urdu\", \"Uzbek\", \"Vietnamese\", \"Chinese\", \"Zulu\"]\n",
        "VOICE_NAME = \"Antoni\"  # @param ['Rachel', 'Drew', 'Clyde', 'Paul', 'Domi', 'Dave', 'Fin', 'Sarah', 'Antoni', 'Thomas', 'Charlie', 'George', 'Emily', 'Elli', 'Callum', 'Patrick', 'Harry', 'Liam', 'Dorothy', 'Josh', 'Arnold', 'Charlotte', 'Matilda', 'Matthew', 'James', 'Joseph', 'Jeremy', 'Michael', 'Ethan', 'Gigi', 'Freya', 'Grace', 'Daniel', 'Lily', 'Serena', 'Adam', 'Nicole', 'Bill', 'Jessie', 'Sam', 'Glinda', 'Giovanni', 'Mimi', 'Claribel Dervla', 'Daisy Studious', 'Gracie Wise', 'Tammie Ema', 'Alison Dietlinde', 'Ana Florence', 'Annmarie Nele', 'Asya Anara', 'Brenda Stern', 'Gitta Nikolina', 'Henriette Usha', 'Sofia Hellen', 'Tammy Grit', 'Tanja Adelina', 'Vjollca Johnnie', 'Andrew Chipper', 'Badr Odhiambo', 'Dionisio Schuyler', 'Royston Min', 'Viktor Eka', 'Abrahan Mack', 'Adde Michal', 'Baldur Sanjin', 'Craig Gutsy', 'Damien Black', 'Gilberto Mathias', 'Ilkin Urbano', 'Kazuhiko Atallah', 'Ludvig Milivoj', 'Suad Qasim', 'Torcull Diarmuid', 'Viktor Menelaos', 'Zacharie Aimilios', 'Nova Hogarth', 'Maja Ruoho', 'Uta Obando', 'Barbora MacLean', 'Alexandra Hisakawa', 'Alma María', 'Rosemary Okafor', 'Ige Behringer', 'Filip Traverse', 'Damjan Chapman', 'Wulf Carlevaro', 'Aaron Dreschner', 'Kumar Dahl', 'Eugenio Mataracı', 'Ferran Simen', 'Xavier Hayasaka', 'Luis Moray', 'Marcos Rudaski']\n",
        "USE_IMAGE = 10  # @param {type:\"integer\"}\n",
        "WATERMARK = \"\"  # @param {type:\"string\"}\n",
        "BG_VIDEO = \"Ski gameplay\"  # @param {type:\"string\"}\n",
        "BG_MUSIC = \"Music joakim karud dreams\"  # @param {type:\"string\"}\n",
        "FONT_STYLE = Anta-Regular.ttf  # @param [\"Arial-Bold\", \"Roboto-Regular\", \"Times New Roman\"] # New parameter for font style\n",
        "\n",
        "# Set the API keys for different services\n",
        "ApiKeyManager.set_api_key(ApiProvider.OPENAI, OPENAI_API)\n",
        "ApiKeyManager.set_api_key(ApiProvider.ELEVEN_LABS, ELEVEN_LABS_API)\n",
        "ApiKeyManager.set_api_key(ApiProvider.PEXELS, PEXELS_API)\n",
        "\n",
        "def select_voice_module(tts_engine, language, voice):\n",
        "    if tts_engine == \"Edge TTS\":\n",
        "        voice_name = EDGE_TTS_VOICENAME_MAPPING[Language[language.upper()]]['male']  # Defaulting to male if specific voice not handled\n",
        "        return EdgeTTSVoiceModule(voice_name)\n",
        "    elif tts_engine == \"ElevenLabs\":\n",
        "        return ElevenLabsVoiceModule(api_key=ELEVEN_LABS_API, voiceName=voice)\n",
        "    elif tts_engine == \"Coqui TTS\":\n",
        "        language_code = LANGUAGE_ACRONYM_MAPPING.get(Language[language.upper()], 'en')  # Default to 'en' if not found\n",
        "        return CoquiVoiceModule(voiceName=voice, language=language_code)\n",
        "    else:\n",
        "        raise ValueError(\"Unsupported TTS Engine\")\n",
        "\n",
        "# Correctly select the voice module based on the TTS_ENGINE parameter\n",
        "try:\n",
        "    voice_module = select_voice_module(TTS_ENGINE, LANGUAGE, VOICE_NAME)\n",
        "except ValueError as e:\n",
        "    print(f\"Error selecting voice module: {e}\")\n",
        "    # Fallback to a default voice module if error occurs\n",
        "    voice_module = EdgeTTSVoiceModule(EDGE_TTS_VOICENAME_MAPPING[Language.ENGLISH]['male'])\n",
        "\n",
        "# Configure the Content Engine with FONT_STYLE parameter\n",
        "content_engine = FactsShortEngine(\n",
        "    voiceModule=voice_module,\n",
        "    facts_type=TYPE_OF_SHORTS,\n",
        "    background_video_name=BG_VIDEO,\n",
        "    background_music_name=BG_MUSIC,\n",
        "    num_images=USE_IMAGE,\n",
        "    watermark=WATERMARK,\n",
        "    language=Language[LANGUAGE.upper()],\n",
        ")\n",
        "\n",
        "# Generate Content\n",
        "try:\n",
        "    for step_num, step_logs in content_engine.makeContent():\n",
        "        print(f\"Step {step_num}: {step_logs}\")\n",
        "except Exception as e:\n",
        "    print(f\"An error occurred: {e}\")\n",
        "\n",
        "# Get Video Output Path\n",
        "print(content_engine.get_video_output_path())"
      ],
      "metadata": {
        "cellView": "form",
        "id": "JkG0Os0aJMqF"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "#@markdown <center><h2>Script To Video</h2>Make Sure To Select ElevenLabs Or Edge TTS Only</h3></center><br>\n",
        "# Import necessary modules from the ShortGPT framework\n",
        "from shortGPT.config.api_db import ApiKeyManager, ApiProvider\n",
        "from shortGPT.config.asset_db import AssetDatabase, AssetType\n",
        "from shortGPT.engine.content_video_engine import ContentVideoEngine\n",
        "from shortGPT.config.languages import Language, EDGE_TTS_VOICENAME_MAPPING\n",
        "from shortGPT.audio.edge_voice_module import EdgeTTSVoiceModule\n",
        "from shortGPT.audio.eleven_voice_module import ElevenLabsVoiceModule\n",
        "from shortGPT.audio.coqui_voice_module import CoquiVoiceModule\n",
        "\n",
        "# Load API keys from hardcoded values - Consider using environment variables for better security\n",
        "OPENAI_KEY = \"\"  # @param {type:\"string\"}\n",
        "ELEVEN_KEY = \"\"  # @param {type:\"string\"}\n",
        "PEXELS_KEY = \"\"  # @param {type:\"string\"}\n",
        "\n",
        "# Set API Keys\n",
        "ApiKeyManager.set_api_key(ApiProvider.OPENAI, OPENAI_KEY)\n",
        "ApiKeyManager.set_api_key(ApiProvider.ELEVEN_LABS, ELEVEN_KEY)\n",
        "ApiKeyManager.set_api_key(ApiProvider.PEXELS, PEXELS_KEY)\n",
        "\n",
        "# Add Assets\n",
        "AssetDatabase.add_remote_asset('chill music', AssetType.BACKGROUND_MUSIC, \"https://www.youtube.com/watch?v=uUu1NcSHg2E\")\n",
        "\n",
        "# Function to select the voice module based on user preference\n",
        "def select_voice_module(tts_engine, language, voice):\n",
        "    if tts_engine == \"Edge TTS\":\n",
        "        voice_name = EDGE_TTS_VOICENAME_MAPPING[Language[language.upper()]]['male']  # Defaulting to male if specific voice not handled\n",
        "        return EdgeTTSVoiceModule(voice_name)\n",
        "    elif tts_engine == \"ElevenLabs\":\n",
        "        if language not in eleven_labs_languages or voice not in eleven_labs_voices:\n",
        "            raise ValueError(f\"Selected language '{language}' or voice '{voice}' is not supported by ElevenLabs. Supported languages are: {', '.join(eleven_labs_languages)}. Supported voices are: {', '.join(eleven_labs_voices)}.\")\n",
        "        return ElevenLabsVoiceModule(api_key=ELEVEN_KEY, voiceName=voice)\n",
        "    elif tts_engine == \"Coqui TTS\":\n",
        "        if language not in coqui_tts_languages or voice not in coqui_tts_voices:\n",
        "            raise ValueError(f\"Selected language '{language}' or voice '{voice}' is not supported by Coqui TTS. Supported languages are: {', '.join(coqui_tts_languages)}. Supported voices are: {', '.join(coqui_tts_voices)}.\")\n",
        "        return CoquiVoiceModule(voiceName=voice, language=language)\n",
        "    else:\n",
        "        raise ValueError(\"Unsupported TTS Engine\")\n",
        "\n",
        "# Configure the Voice Module\n",
        "TEXT_TO_SPEECH = \"Edge TTS\"  # @param [\"Edge TTS\", \"ElevenLabs\", \"Coqui TTS\"]\n",
        "LANGUAGE = \"English\"  # @param [\"English\", \"Spanish\", \"French\", \"Arabic\", \"German\", \"Polish\", \"Italian\", \"Portuguese\"]\n",
        "VOICE = \"Damjan Chapman\"  # @param ['Rachel', 'Drew', 'Clyde', 'Paul', 'Domi', 'Dave', 'Fin', 'Sarah', 'Antoni', 'Thomas', 'Charlie', 'George', 'Emily', 'Elli', 'Callum', 'Patrick', 'Harry', 'Liam', 'Dorothy', 'Josh', 'Arnold', 'Charlotte', 'Matilda', 'Matthew', 'James', 'Joseph', 'Jeremy', 'Michael', 'Ethan', 'Gigi', 'Freya', 'Grace', 'Daniel', 'Lily', 'Serena', 'Adam', 'Nicole', 'Bill', 'Jessie', 'Sam', 'Glinda', 'Giovanni', 'Mimi', 'Claribel Dervla', 'Daisy Studious', 'Gracie Wise', 'Tammie Ema', 'Alison Dietlinde', 'Ana Florence', 'Annmarie Nele', 'Asya Anara', 'Brenda Stern', 'Gitta Nikolina', 'Henriette Usha', 'Sofia Hellen', 'Tammy Grit', 'Tanja Adelina', 'Vjollca Johnnie', 'Andrew Chipper', 'Badr Odhiambo', 'Dionisio Schuyler', 'Royston Min', 'Viktor Eka', 'Abrahan Mack', 'Adde Michal', 'Baldur Sanjin', 'Craig Gutsy', 'Damien Black', 'Gilberto Mathias', 'Ilkin Urbano', 'Kazuhiko Atallah', 'Ludvig Milivoj', 'Suad Qasim', 'Torcull Diarmuid', 'Viktor Menelaos', 'Zacharie Aimilios', 'Nova Hogarth', 'Maja Ruoho', 'Uta Obando', 'Barbora MacLean', 'Alexandra Hisakawa', 'Alma María', 'Rosemary Okafor', 'Ige Behringer', 'Filip Traverse', 'Damjan Chapman', 'Wulf Carlevaro', 'Aaron Dreschner', 'Kumar Dahl', 'Eugenio Mataracı', 'Ferran Simen', 'Xavier Hayasaka', 'Luis Moray', 'Marcos Rudaski']\n",
        "try:\n",
        "    voice_module = select_voice_module(TEXT_TO_SPEECH, LANGUAGE, VOICE)\n",
        "except ValueError as e:\n",
        "    print(f\"Error selecting voice module: {e}\")\n",
        "    # Fallback to a default voice module if error occurs\n",
        "    voice_module = EdgeTTSVoiceModule(EDGE_TTS_VOICENAME_MAPPING[Language.ENGLISH]['male'])\n",
        "\n",
        "# Prepare the script\n",
        "SCRIPT = \"\\\"Artificial intelligence (AI) is revolutionizing our world in surprising ways. Robots and virtual assistants help us in our daily tasks and simplify our lives. In medicine, AI enables more accurate diagnoses and advances in treatments. In the automotive industry, autonomous vehicles are changing the way we get around. However, questions arise about the impact on employment and the ethics of its use. Despite the challenges, AI promises an exciting future full of possibilities. Are we ready to embrace this technological advancement?\"  # @param {type:\"string\"}\n",
        "\n",
        "# Configure Content Engine\n",
        "content_engine = ContentVideoEngine(voice_module, SCRIPT, background_music_name='chill music', language=Language[LANGUAGE.upper()])\n",
        "\n",
        "# Generate Content with error handling\n",
        "try:\n",
        "    for step_num, step_logs in content_engine.makeContent():\n",
        "        print(f\"Step {step_num}: {step_logs}\")\n",
        "except Exception as e:\n",
        "    print(f\"Error generating content: {e}\")\n",
        "\n",
        "# Get Video Output Path\n",
        "print(\"Video Output Path:\", content_engine.get_video_output_path())"
      ],
      "metadata": {
        "cellView": "form",
        "id": "lBqNgUmbacdF"
      },
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "source": [
        "# Import necessary modules from the ShortGPT framework\n",
        "from shortGPT.config.api_db import ApiKeyManager, ApiProvider\n",
        "from shortGPT.config.asset_db import AssetDatabase, AssetType\n",
        "from shortGPT.engine.content_video_engine import ContentVideoEngine\n",
        "from shortGPT.config.languages import Language, EDGE_TTS_VOICENAME_MAPPING, LANGUAGE_ACRONYM_MAPPING\n",
        "from shortGPT.audio.edge_voice_module import EdgeTTSVoiceModule\n",
        "from shortGPT.audio.eleven_voice_module import ElevenLabsVoiceModule\n",
        "from shortGPT.audio.coqui_voice_module import CoquiVoiceModule\n",
        "\n",
        "# Load API keys from hardcoded values - Consider using environment variables for better security\n",
        "OPENAI_KEY = \"\"  # @param {type:\"string\"}\n",
        "ELEVEN_KEY = \"\"  # @param {type:\"string\"}\n",
        "PEXELS_KEY = \"\"  # @param {type:\"string\"}\n",
        "\n",
        "# Set API Keys\n",
        "ApiKeyManager.set_api_key(ApiProvider.OPENAI, OPENAI_KEY)\n",
        "ApiKeyManager.set_api_key(ApiProvider.ELEVEN_LABS, ELEVEN_KEY)\n",
        "ApiKeyManager.set_api_key(ApiProvider.PEXELS, PEXELS_KEY)\n",
        "\n",
        "# Add Assets\n",
        "AssetDatabase.add_remote_asset('chill music', AssetType.BACKGROUND_MUSIC, \"https://www.youtube.com/watch?v=uUu1NcSHg2E\")\n",
        "\n",
        "# Function to select the voice module based on user preference\n",
        "def select_voice_module(tts_engine, language, voice):\n",
        "    if tts_engine == \"Edge TTS\":\n",
        "        voice_name = EDGE_TTS_VOICENAME_MAPPING[Language[language.upper()]]['male']  # Defaulting to male if specific voice not handled\n",
        "        return EdgeTTSVoiceModule(voice_name)\n",
        "    elif tts_engine == \"ElevenLabs\":\n",
        "        # Assuming eleven_labs_languages and eleven_labs_voices are defined elsewhere\n",
        "        return ElevenLabsVoiceModule(api_key=ELEVEN_KEY, voiceName=voice)\n",
        "    elif tts_engine == \"Coqui TTS\":\n",
        "        language_code = LANGUAGE_ACRONYM_MAPPING.get(Language[language.upper()], 'en')  # Default to 'en' if not found\n",
        "        return CoquiVoiceModule(voiceName=voice, language=language_code)\n",
        "    else:\n",
        "        raise ValueError(\"Unsupported TTS Engine\")\n",
        "\n",
        "# Configure the Voice Module\n",
        "TEXT_TO_SPEECH = \"Coqui TTS\"  # @param [\"Edge TTS\", \"ElevenLabs\", \"Coqui TTS\"]\n",
        "LANGUAGE = \"Hindi\"  # @param [\"English\", \"Hindi\", \"French\", \"Arabic\", \"Urdu\", \"Roman Urdu\", \"Italian\", \"Portuguese\"]\n",
        "VOICE = \"Damjan Chapman\"  # @param ['Rachel', 'Drew', 'Clyde', 'Paul', 'Domi', 'Dave', 'Fin', 'Sarah', 'Antoni', 'Thomas', 'Charlie', 'George', 'Emily', 'Elli', 'Callum', 'Patrick', 'Harry', 'Liam', 'Dorothy', 'Josh', 'Arnold', 'Charlotte', 'Matilda', 'Matthew', 'James', 'Joseph', 'Jeremy', 'Michael', 'Ethan', 'Gigi', 'Freya', 'Grace', 'Daniel', 'Lily', 'Serena', 'Adam', 'Nicole', 'Bill', 'Jessie', 'Sam', 'Glinda', 'Giovanni', 'Mimi', 'Claribel Dervla', 'Daisy Studious', 'Gracie Wise', 'Tammie Ema', 'Alison Dietlinde', 'Ana Florence', 'Annmarie Nele', 'Asya Anara', 'Brenda Stern', 'Gitta Nikolina', 'Henriette Usha', 'Sofia Hellen', 'Tammy Grit', 'Tanja Adelina', 'Vjollca Johnnie', 'Andrew Chipper', 'Badr Odhiambo', 'Dionisio Schuyler', 'Royston Min', 'Viktor Eka', 'Abrahan Mack', 'Adde Michal', 'Baldur Sanjin', 'Craig Gutsy', 'Damien Black', 'Gilberto Mathias', 'Ilkin Urbano', 'Kazuhiko Atallah', 'Ludvig Milivoj', 'Suad Qasim', 'Torcull Diarmuid', 'Viktor Menelaos', 'Zacharie Aimilios', 'Nova Hogarth', 'Maja Ruoho', 'Uta Obando', 'Barbora MacLean', 'Alexandra Hisakawa', 'Alma María', 'Rosemary Okafor', 'Ige Behringer', 'Filip Traverse', 'Damjan Chapman', 'Wulf Carlevaro', 'Aaron Dreschner', 'Kumar Dahl', 'Eugenio Mataracı', 'Ferran Simen', 'Xavier Hayasaka', 'Luis Moray', 'Marcos Rudaski']\n",
        "# Prepare the script\n",
        "SCRIPT = \"SCRIPT = \\\"एक समय की बात है, जब पृथ्वी पर जीवन की शुरुआत हुई थी। इस ग्रह पर एक अनोखी प्रजाति ने अपने कदम रखे, जिसे हम मानव कहते हैं। यह कहानी है उस मानव जाति की, जिसने समय के साथ अपने जीवन को नई दिशा दी। शुरुआत में, मानव जंगलों और गुफाओं में रहते थे। उनका जीवन संघर्षों से भरा था। उन्होंने आग की खोज की, जिससे उनके जीवन में एक नई रोशनी आई। आग ने उन्हें ठंड से बचाया और खाना पकाने का तरीका सिखाया। समय के साथ, मानव ने खेती की शुरुआत की। उन्होंने अनाज उगाना शुरू किया और पशुओं को पालना सीखा। इससे उनके जीवन में स्थिरता आई और समाज का विकास हुआ। फिर आया सभ्यताओं का युग। मानव ने नदियों के किनारे बस्तियाँ बसाईं और विशाल साम्राज्यों की नींव रखी। उन्होंने लिपि का आविष्कार किया, जिससे ज्ञान का संचार हुआ। विज्ञान, कला, और साहित्य के क्षेत्र में उन्होंने अद्भुत कार्य किए। लेकिन मानव इतिहास में संघर्ष भी रहे। युद्ध, महामारी, और प्राकृतिक आपदाओं ने मानवता की परीक्षा ली। फिर भी, मानव ने कभी हार नहीं मानी। उन्होंने हर बार उठकर एक नई शुरुआत की। आज, हम एक ऐसे युग में हैं, जहाँ तकनीकी ने हमारे जीवन को बदल दिया है। हमने चाँद पर कदम रखा है और अंतरिक्ष की गहराइयों को छूने की कोशिश की है। यह कहानी हमें याद दिलाती है कि मानव जाति का इतिहास संघर्ष और विजय की कहानी है। हमारी यात्रा अद्भुत रही है, और हमारा भविष्य अभी भी लिखा जा रहा है। हमें अपने पूर्वजों की विरासत को आगे बढ़ा\"   # @param {type:\"string\"}\n",
        "\n",
        "try:\n",
        "    voice_module = select_voice_module(TEXT_TO_SPEECH, LANGUAGE, VOICE)\n",
        "except ValueError as e:\n",
        "    print(f\"Error selecting voice module: {e}\")\n",
        "    # Fallback to a default voice module if error occurs\n",
        "    voice_module = EdgeTTSVoiceModule(EDGE_TTS_VOICENAME_MAPPING[Language.ENGLISH]['male'])\n",
        "\n",
        "# Prepare the script\n",
        "SCRIPT = \"\\\"Artificial intelligence (AI) is revolutionizing our world in surprising ways. Robots and virtual assistants help us in our daily tasks and simplify our lives. In medicine, AI enables more accurate diagnoses and advances in treatments. In the automotive industry, autonomous vehicles are changing the way we get around. However, questions arise about the impact on employment and the ethics of its use. Despite the challenges, AI promises an exciting future full of possibilities. Are we ready to embrace this technological advancement?\"\n",
        "\n",
        "# Configure Content Engine\n",
        "content_engine = ContentVideoEngine(voice_module, SCRIPT, background_music_name='chill music', language=Language[LANGUAGE.upper()])\n",
        "\n",
        "# Generate Content with error handling\n",
        "try:\n",
        "    for step_num, step_logs in content_engine.makeContent():\n",
        "        print(f\"Step {step_num}: {step_logs}\")\n",
        "except Exception as e:\n",
        "    print(f\"Error generating content: {e}\")\n",
        "\n",
        "# Get Video Output Path\n",
        "print(\"Video Output Path:\", content_engine.get_video_output_path())"
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "cellView": "form",
        "id": "s8eBfDIO6Ayl",
        "outputId": "b54a9d5f-aa05-47f6-c195-9e1b2812fa92"
      },
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            " > tts_models/multilingual/multi-dataset/xtts_v2 is already downloaded.\n",
            "Error selecting voice module: Expecting value: line 1 column 1 (char 0)\n",
            "Step 1: Current step (1 / 10) : _generateTempAudio\n",
            "Step 2: Current step (2 / 10) : _speedUpAudio\n",
            "Step 3: Current step (3 / 10) : _timeCaptions\n",
            "Importing the dtw module. When using in academic works please cite:\n",
            "  T. Giorgino. Computing and Visualizing Dynamic Time Warping Alignments in R: The dtw Package.\n",
            "  J. Stat. Soft., doi:10.18637/jss.v031.i07.\n",
            "\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "100%|███████████████████████████████████████| 139M/139M [00:03<00:00, 39.6MiB/s]\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Detected language: English\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "100%|██████████| 396/396 [00:00<00:00, 858.28frames/s]\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Step 4: Current step (4 / 10) : _generateVideoSearchTerms\n",
            "Expecting value: line 1 column 1 (char 0)\n",
            "not the right format\n",
            "Expecting value: line 1 column 1 (char 0)\n",
            "not the right format\n",
            "Expecting value: line 1 column 1 (char 0)\n",
            "not the right format\n",
            "Expecting value: line 1 column 1 (char 0)\n",
            "not the right format\n",
            "Expecting value: line 1 column 1 (char 0)\n",
            "not the right format\n",
            "Expecting value: line 1 column 1 (char 0)\n",
            "not the right format\n",
            "Expecting value: line 1 column 1 (char 0)\n",
            "not the right format\n",
            "Step 5: Current step (5 / 10) : _generateVideoUrls\n",
            "Step 6: Current step (6 / 10) : _chooseBackgroundMusic\n",
            "\u001b[KStep 7: Current step (7 / 10) : _prepareBackgroundAssets\n",
            "Step 8: Current step (8 / 10) : _prepareCustomAssets\n",
            "Step 9: Current step (9 / 10) : Preparing rendering assets...\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "\n",
            "\u001b[A\n",
            "100%|██████████| 68.0/68.0 [09:58<00:00, 8.80s/iB]\u001b[A\n",
            "\u001b[A\n",
            "100%|██████████| 68.0/68.0 [09:58<00:00, 8.80s/iB]\u001b[A"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Moviepy - Building video .editing_assets/general_video_assets/d497348cbfcb418d835889a4/rendered_video.mp4.\n",
            "MoviePy - Writing audio in rendered_videoTEMP_MPY_wvf_snd.mp4\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "\n",
            "\u001b[A\n",
            "100%|██████████| 68.0/68.0 [09:58<00:00, 8.80s/iB]\u001b[A\n",
            "\u001b[A\n",
            "100%|██████████| 68.0/68.0 [09:58<00:00, 8.80s/iB]\u001b[A"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "MoviePy - Done.\n",
            "Moviepy - Writing video .editing_assets/general_video_assets/d497348cbfcb418d835889a4/rendered_video.mp4\n",
            "\n"
          ]
        },
        {
          "output_type": "stream",
          "name": "stderr",
          "text": [
            "\n",
            "\u001b[A\n",
            "100%|██████████| 68.0/68.0 [10:05<00:00, 8.90s/iB]\u001b[A\n",
            "\u001b[A\n",
            "100%|██████████| 68.0/68.0 [10:05<00:00, 8.90s/iB]\u001b[A"
          ]
        },
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "Moviepy - Done !\n",
            "Moviepy - video ready .editing_assets/general_video_assets/d497348cbfcb418d835889a4/rendered_video.mp4\n",
            "Step 10: Current step (10 / 10) : _addMetadata\n",
            "Video Output Path: videos/2024-02-28_21-37-54 - The Future of AI Boon or Bane .mp4\n"
          ]
        }
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": [],
      "gpuType": "T4"
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "nbformat": 4,
  "nbformat_minor": 0
}