Equityone commited on
Commit
60afe6d
·
verified ·
1 Parent(s): 1129bb7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -7
app.py CHANGED
@@ -108,13 +108,20 @@ COMPOSITION_PARAMS = {
108
  }
109
 
110
  class ImageGenerator:
111
- def __init__(self):
112
- self.API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0"
113
- token = os.getenv('HUGGINGFACE_TOKEN')
114
- if not token:
115
- logger.error("HUGGINGFACE_TOKEN non trouvé!")
116
- self.headers = {"Authorization": f"Bearer {token}"}
117
- logger.info("ImageGenerator initialisé")
 
 
 
 
 
 
 
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"""