Update app.py
Browse files
app.py
CHANGED
@@ -108,13 +108,20 @@ COMPOSITION_PARAMS = {
|
|
108 |
}
|
109 |
|
110 |
class ImageGenerator:
|
111 |
-
|
112 |
-
self.API_URL =
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
def _build_prompt(self, params: Dict[str, Any]) -> str:
|
120 |
"""Construction de prompt améliorée"""
|
|
|
108 |
}
|
109 |
|
110 |
class ImageGenerator:
|
111 |
+
def __init__(self):
|
112 |
+
self.API_URL = (
|
113 |
+
f"https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
|
114 |
+
)
|
115 |
+
|
116 |
+
# Chargement du token Hugging Face depuis les variables d'environnement
|
117 |
+
token = os.getenv('HUGGINGFACE_TOKEN')
|
118 |
+
|
119 |
+
if not token:
|
120 |
+
logger.error("HUGGINGFACE_TOKEN non trouvé!")
|
121 |
+
|
122 |
+
self.headers = {"Authorization": f"Bearer {token}"}
|
123 |
+
|
124 |
+
logger.info("ImageGenerator initialisé")
|
125 |
|
126 |
def _build_prompt(self, params: Dict[str, Any]) -> str:
|
127 |
"""Construction de prompt améliorée"""
|