From aa0190d218b1c7bf731ec012af1314ad1304ee52 Mon Sep 17 00:00:00 2001 From: Xavier Date: Thu, 27 Aug 2026 20:21:57 +0200 Subject: [PATCH] Contournement de la panne DNS Hugging Face via le nouveau routeur --- modules/ai_media.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ai_media.py b/modules/ai_media.py index 36564e2..703e28b 100644 --- a/modules/ai_media.py +++ b/modules/ai_media.py @@ -54,7 +54,7 @@ def generer_image_huggingface(prompt: str) -> tuple: api_key = os.getenv("HUGGINGFACE_API_KEY") if not api_key: return None, "Clé API manquante" - url = "https://router.huggingface.co/hf-inference/models/stabilityai/stable-diffusion-xl-base-1.0" + url = "https://router.huggingface.co/hf-inference/models/black-forest-labs/FLUX.1-schnell" headers = {"Authorization": f"Bearer {api_key}"} try: @@ -115,18 +115,18 @@ def generer_les_images(prompt: str, fichiers: list, premium: bool) -> tuple: else: trace.append("🔴 CF : Échec") - # Traitement HuggingFace + # Traitement HuggingFace if img_hf: nom_hf = f"img_hf_{int(time.time())}.png" with open(os.path.join(dossier_media, nom_hf), 'wb') as f: f.write(img_hf) - reponse_md += f"### 🤗 HuggingFace (SDXL)\n![HuggingFace](/Media/{nom_hf})\n" + reponse_md += f"### 🤗 HuggingFace (FLUX.1)\n![HuggingFace](/Media/{nom_hf})\n" reponse_md += f"**[📥 Télécharger l'image HF](/Media/{nom_hf})**\n\n" fournisseurs_actifs.append("HuggingFace") trace.append("🟢 HF : Succès") else: erreur_courte = str(msg_hf)[:50] + "..." if len(str(msg_hf)) > 50 else str(msg_hf) trace.append(f"🔴 HF : Échec ({erreur_courte})") - reponse_md += f"### 🤗 HuggingFace (SDXL)\n*⚠️ Échec de la génération : {msg_hf}*\n\n" + reponse_md += f"### 🤗 HuggingFace (FLUX.1)\n*⚠️ Échec de la génération : {msg_hf}*\n\n" if not img_or and not img_cf and not img_hf: return "*Échec critique : Aucune API n'a pu générer d'image.*", "#ff4444", "Système", "Erreur", trace