Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -380,6 +380,7 @@ def build_capsule(titre, sous_titre, texte_voix, texte_ecran, theme,
|
|
| 380 |
except Exception as e:
|
| 381 |
print(f"[Audio] Normalisation échouée ({e}), on garde {audio_mp}")
|
| 382 |
|
|
|
|
| 383 |
# 2) Fond (PIL)
|
| 384 |
fond_path = make_background(titre, sous_titre, texte_ecran, theme,
|
| 385 |
logo_path, logo_pos, image_fond, fond_mode)
|
|
@@ -391,6 +392,14 @@ def build_capsule(titre, sous_titre, texte_voix, texte_ecran, theme,
|
|
| 391 |
audio = AudioFileClip(audio_wav)
|
| 392 |
dur = float(audio.duration or 5.0)
|
| 393 |
target_fps = 25
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 394 |
bg = ImageClip(fond_path).set_duration(dur)
|
| 395 |
|
| 396 |
# 4) Vidéo présentateur (au lieu de SadTalker)
|
|
|
|
| 380 |
except Exception as e:
|
| 381 |
print(f"[Audio] Normalisation échouée ({e}), on garde {audio_mp}")
|
| 382 |
|
| 383 |
+
|
| 384 |
# 2) Fond (PIL)
|
| 385 |
fond_path = make_background(titre, sous_titre, texte_ecran, theme,
|
| 386 |
logo_path, logo_pos, image_fond, fond_mode)
|
|
|
|
| 392 |
audio = AudioFileClip(audio_wav)
|
| 393 |
dur = float(audio.duration or 5.0)
|
| 394 |
target_fps = 25
|
| 395 |
+
|
| 396 |
+
# CORRECTION : Vérifier que le fond existe
|
| 397 |
+
if not os.path.exists(fond_path):
|
| 398 |
+
print(f"❌ Fichier fond manquant, création d'urgence: {fond_path}")
|
| 399 |
+
emergency_bg = Image.new("RGB", (W, H), (0, 82, 147))
|
| 400 |
+
fond_path = os.path.join(TMP_DIR, f"emergency_{uuid.uuid4().hex[:6]}.png")
|
| 401 |
+
emergency_bg.save(fond_path)
|
| 402 |
+
|
| 403 |
bg = ImageClip(fond_path).set_duration(dur)
|
| 404 |
|
| 405 |
# 4) Vidéo présentateur (au lieu de SadTalker)
|