AZILS commited on
Commit
dc3f5ed
·
verified ·
1 Parent(s): 812f159

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -110
app.py CHANGED
@@ -1204,109 +1204,9 @@ class YouTube:
1204
  self.log(error(error_msg))
1205
  raise Exception(error_msg)
1206
 
1207
- # Data for dynamic dropdowns
1208
- def get_text_generator_models(generator):
1209
- """Get available models for the selected text generator."""
1210
- models = {
1211
- "gemini": [
1212
- "gemini-2.0-flash",
1213
- "gemini-2.0-flash-lite",
1214
- "gemini-1.5-flash",
1215
- "gemini-1.5-flash-8b",
1216
- "gemini-1.5-pro"
1217
- ],
1218
- "g4f": [
1219
- "gpt-4",
1220
- "gpt-4o",
1221
- "gpt-3.5-turbo",
1222
- "llama-3-70b-chat",
1223
- "claude-3-opus-20240229",
1224
- "claude-3-sonnet-20240229",
1225
- "claude-3-haiku-20240307"
1226
- ],
1227
- "openai": [
1228
- "gpt-4o",
1229
- "gpt-4-turbo",
1230
- "gpt-3.5-turbo"
1231
- ]
1232
- }
1233
- return models.get(generator, ["default"])
1234
 
1235
- def get_image_generator_models(generator):
1236
- """Get available models for the selected image generator."""
1237
- models = {
1238
- "prodia": [
1239
- "sdxl",
1240
- "realvisxl",
1241
- "juggernaut",
1242
- "dreamshaper",
1243
- "dalle"
1244
- ],
1245
- "hercai": [
1246
- "v1",
1247
- "v2",
1248
- "v3",
1249
- "lexica"
1250
- ],
1251
- "g4f": [
1252
- "flux",
1253
- "dall-e-3",
1254
- "dall-e-2",
1255
- "midjourney"
1256
- ],
1257
- "segmind": [
1258
- "sdxl-turbo",
1259
- "realistic-vision",
1260
- "sd3"
1261
- ],
1262
- "pollinations": [
1263
- "default"
1264
- ]
1265
- }
1266
- return models.get(generator, ["default"])
1267
 
1268
- def get_tts_voices(engine):
1269
- """Get available voices for the selected TTS engine."""
1270
- voices = {
1271
- "elevenlabs": [
1272
- "Sarah",
1273
- "Brian",
1274
- "Lily",
1275
- "Monika Sogam",
1276
- "George",
1277
- "River",
1278
- "Matilda",
1279
- "Will",
1280
- "Jessica"
1281
- ],
1282
- "openai": [
1283
- "alloy",
1284
- "echo",
1285
- "fable",
1286
- "onyx",
1287
- "nova",
1288
- "shimmer"
1289
- ],
1290
- "edge": [
1291
- "en-US-AriaNeural",
1292
- "en-US-GuyNeural",
1293
- "en-GB-SoniaNeural",
1294
- "en-AU-NatashaNeural"
1295
- ],
1296
- "gtts": [
1297
- "en",
1298
- "es",
1299
- "fr",
1300
- "de",
1301
- "it",
1302
- "pt",
1303
- "ru",
1304
- "ja",
1305
- "zh",
1306
- "hi"
1307
- ]
1308
- }
1309
- return voices.get(engine, ["default"])
1310
 
1311
  # Create the Gradio interface
1312
  def create_interface():
@@ -1340,7 +1240,7 @@ def create_interface():
1340
  with gr.Group():
1341
  gr.Markdown("### 🔧 Generator Settings")
1342
  with gr.Tabs():
1343
- with gr.Tab("Text"):
1344
  text_gen = gr.Dropdown(
1345
  choices=["g4f", "gemini", "openai"],
1346
  label="Text Generator",
@@ -1352,7 +1252,7 @@ def create_interface():
1352
  value="gpt-4"
1353
  )
1354
 
1355
- with gr.Tab("Image"):
1356
  image_gen = gr.Dropdown(
1357
  choices=["g4f", "prodia", "hercai", "segmind", "pollinations"],
1358
  label="Image Generator",
@@ -1364,7 +1264,7 @@ def create_interface():
1364
  value="flux"
1365
  )
1366
 
1367
- with gr.Tab("Audio"):
1368
  tts_engine = gr.Dropdown(
1369
  choices=["edge", "elevenlabs", "gtts", "openai"],
1370
  label="Speech Engine",
@@ -1381,7 +1281,7 @@ def create_interface():
1381
  value="random"
1382
  )
1383
 
1384
- with gr.Tab("Subtitles"):
1385
  subtitles_enabled = gr.Checkbox(label="Enable Subtitles", value=True)
1386
  highlighting_enabled = gr.Checkbox(label="Enable Word Highlighting", value=True)
1387
  subtitle_font = gr.Dropdown(
@@ -1440,15 +1340,15 @@ def create_interface():
1440
  # Right panel: Output display
1441
  with gr.Column(scale=1, min_width=400):
1442
  with gr.Tabs():
1443
- with gr.Tab("Video", selected=True):
1444
  video_output = gr.Video(label="Generated Video", height=600)
1445
 
1446
- with gr.Tab("Metadata"):
1447
  title_output = gr.Textbox(label="Title", lines=2)
1448
  description_output = gr.Textbox(label="Description", lines=4)
1449
  script_output = gr.Textbox(label="Script", lines=8)
1450
 
1451
- with gr.Tab("Log"):
1452
  log_output = gr.Textbox(label="Process Log", lines=20, max_lines=100)
1453
 
1454
  # Dynamic dropdown updates
@@ -1583,5 +1483,4 @@ if __name__ == "__main__":
1583
 
1584
  # Launch the app
1585
  demo = create_interface()
1586
- demo.launch()
1587
-
 
1204
  self.log(error(error_msg))
1205
  raise Exception(error_msg)
1206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1208
 
1209
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1210
 
1211
  # Create the Gradio interface
1212
  def create_interface():
 
1240
  with gr.Group():
1241
  gr.Markdown("### 🔧 Generator Settings")
1242
  with gr.Tabs():
1243
+ with gr.TabItem("Text"):
1244
  text_gen = gr.Dropdown(
1245
  choices=["g4f", "gemini", "openai"],
1246
  label="Text Generator",
 
1252
  value="gpt-4"
1253
  )
1254
 
1255
+ with gr.TabItem("Image"):
1256
  image_gen = gr.Dropdown(
1257
  choices=["g4f", "prodia", "hercai", "segmind", "pollinations"],
1258
  label="Image Generator",
 
1264
  value="flux"
1265
  )
1266
 
1267
+ with gr.TabItem("Audio"):
1268
  tts_engine = gr.Dropdown(
1269
  choices=["edge", "elevenlabs", "gtts", "openai"],
1270
  label="Speech Engine",
 
1281
  value="random"
1282
  )
1283
 
1284
+ with gr.TabItem("Subtitles"):
1285
  subtitles_enabled = gr.Checkbox(label="Enable Subtitles", value=True)
1286
  highlighting_enabled = gr.Checkbox(label="Enable Word Highlighting", value=True)
1287
  subtitle_font = gr.Dropdown(
 
1340
  # Right panel: Output display
1341
  with gr.Column(scale=1, min_width=400):
1342
  with gr.Tabs():
1343
+ with gr.TabItem("Video"):
1344
  video_output = gr.Video(label="Generated Video", height=600)
1345
 
1346
+ with gr.TabItem("Metadata"):
1347
  title_output = gr.Textbox(label="Title", lines=2)
1348
  description_output = gr.Textbox(label="Description", lines=4)
1349
  script_output = gr.Textbox(label="Script", lines=8)
1350
 
1351
+ with gr.TabItem("Log"):
1352
  log_output = gr.Textbox(label="Process Log", lines=20, max_lines=100)
1353
 
1354
  # Dynamic dropdown updates
 
1483
 
1484
  # Launch the app
1485
  demo = create_interface()
1486
+ demo.launch()