mgbam commited on
Commit
aa37e0c
·
verified ·
1 Parent(s): 6e34739

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -65,10 +65,10 @@ def generate_video_from_topic(topic_prompt, progress=gr.Progress(track_tqdm=True
65
  audio_path = f"audio_{job_id}.mp3"
66
  intermediate_files.append(audio_path)
67
 
68
- # !!!!!!!!!!! THIS IS THE FINAL, VERIFIED METHOD FOR LATEST SDK !!!!!!!!!!!
69
- # The function is client.text_to_speech.convert()
70
  response = elevenlabs_client.text_to_speech.convert(
71
- voice_id="Adam", # You can use a voice name or ID
72
  text=narration,
73
  model_id="eleven_multilingual_v2"
74
  )
@@ -84,8 +84,6 @@ def generate_video_from_topic(topic_prompt, progress=gr.Progress(track_tqdm=True
84
  video_clip_paths = []
85
  for i, scene_prompt in enumerate(scene_prompts):
86
  progress(0.4 + (i * 0.12), desc=f"🎬 Generating video scene {i+1}/{len(scene_prompts)}...")
87
- # ... [Rest of the Runway code remains the same] ...
88
- # ... This part is complex but was not the source of the error ...
89
  runway_payload = {"text_prompt": scene_prompt}
90
  post_response = requests.post(RUNWAY_API_URL, headers=RUNWAY_HEADERS, json=runway_payload)
91
  if post_response.status_code != 200:
@@ -96,7 +94,7 @@ def generate_video_from_topic(topic_prompt, progress=gr.Progress(track_tqdm=True
96
  raise gr.Error(f"Runway API did not return a task UUID. Response: {post_response.json()}")
97
 
98
  video_url = None
99
- for _ in range(60): # Poll for up to 10 minutes (60 * 10s)
100
  get_response = requests.get(f"{RUNWAY_API_URL}/{task_id}", headers=RUNWAY_HEADERS)
101
  status_details = get_response.json()
102
  status = status_details.get("status")
@@ -123,7 +121,6 @@ def generate_video_from_topic(topic_prompt, progress=gr.Progress(track_tqdm=True
123
  if chunk: f.write(chunk)
124
  print(f"Video clip saved: {clip_path}")
125
 
126
-
127
  # STEP 5: STITCHING (FFmpeg)
128
  progress(0.9, desc="✂️ Assembling final video with FFmpeg...")
129
  file_list_path = f"file_list_{job_id}.txt"
 
65
  audio_path = f"audio_{job_id}.mp3"
66
  intermediate_files.append(audio_path)
67
 
68
+ # !!!!!!!!!!! THE FINAL FIX !!!!!!!!!!!
69
+ # We now use the official Voice ID for "Adam" instead of the name.
70
  response = elevenlabs_client.text_to_speech.convert(
71
+ voice_id="oWAxZDx7w5z9imAaTrzz", # Official ID for Adam
72
  text=narration,
73
  model_id="eleven_multilingual_v2"
74
  )
 
84
  video_clip_paths = []
85
  for i, scene_prompt in enumerate(scene_prompts):
86
  progress(0.4 + (i * 0.12), desc=f"🎬 Generating video scene {i+1}/{len(scene_prompts)}...")
 
 
87
  runway_payload = {"text_prompt": scene_prompt}
88
  post_response = requests.post(RUNWAY_API_URL, headers=RUNWAY_HEADERS, json=runway_payload)
89
  if post_response.status_code != 200:
 
94
  raise gr.Error(f"Runway API did not return a task UUID. Response: {post_response.json()}")
95
 
96
  video_url = None
97
+ for _ in range(60):
98
  get_response = requests.get(f"{RUNWAY_API_URL}/{task_id}", headers=RUNWAY_HEADERS)
99
  status_details = get_response.json()
100
  status = status_details.get("status")
 
121
  if chunk: f.write(chunk)
122
  print(f"Video clip saved: {clip_path}")
123
 
 
124
  # STEP 5: STITCHING (FFmpeg)
125
  progress(0.9, desc="✂️ Assembling final video with FFmpeg...")
126
  file_list_path = f"file_list_{job_id}.txt"