Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -386,10 +386,10 @@ def generate_persona_image(app_config, *args):
|
|
386 |
return None, log, "Veuillez remplir prénom, nom, âge et genre pour générer l'image."
|
387 |
|
388 |
# --- Construction du Prompt ---
|
389 |
-
gender_en = gender_mapping.get(gender, "person")
|
390 |
-
lens_aperture = "
|
391 |
-
lighting = "soft natural
|
392 |
-
photo_style_details = f"portrait {lighting}, shot on {lens_aperture}
|
393 |
|
394 |
base_description = (
|
395 |
f"{photo_style_details} of {first_name} {last_name}, "
|
@@ -409,9 +409,7 @@ def generate_persona_image(app_config, *args):
|
|
409 |
if persona_description_en: details += f"Context: {persona_description_en}. "
|
410 |
|
411 |
# Négatifs (garder ce qui est pertinent)
|
412 |
-
|
413 |
-
|
414 |
-
final_prompt = f"{base_description}{details}{negatives}"
|
415 |
|
416 |
log = update_log(f"Génération image (début via {api_source}): Prompt='{final_prompt[:100]}...'", log)
|
417 |
|
@@ -420,7 +418,7 @@ def generate_persona_image(app_config, *args):
|
|
420 |
if api_source == "openai":
|
421 |
response = active_client.images.generate(
|
422 |
model=OPENAI_IMAGE_MODEL, prompt=final_prompt, size="1024x1024", n=1,
|
423 |
-
response_format="url", quality="
|
424 |
)
|
425 |
image_url = response.data[0].url
|
426 |
img_response = requests.get(image_url)
|
|
|
386 |
return None, log, "Veuillez remplir prénom, nom, âge et genre pour générer l'image."
|
387 |
|
388 |
# --- Construction du Prompt ---
|
389 |
+
gender_en = gender_mapping.get(gender, "person")
|
390 |
+
lens_aperture = "Kodak Portra 400"
|
391 |
+
lighting = "soft natural light"
|
392 |
+
photo_style_details = f"portrait {lighting}, shot on {lens_aperture}"
|
393 |
|
394 |
base_description = (
|
395 |
f"{photo_style_details} of {first_name} {last_name}, "
|
|
|
409 |
if persona_description_en: details += f"Context: {persona_description_en}. "
|
410 |
|
411 |
# Négatifs (garder ce qui est pertinent)
|
412 |
+
final_prompt = f"{base_description}{details}"
|
|
|
|
|
413 |
|
414 |
log = update_log(f"Génération image (début via {api_source}): Prompt='{final_prompt[:100]}...'", log)
|
415 |
|
|
|
418 |
if api_source == "openai":
|
419 |
response = active_client.images.generate(
|
420 |
model=OPENAI_IMAGE_MODEL, prompt=final_prompt, size="1024x1024", n=1,
|
421 |
+
response_format="url", quality="standard"
|
422 |
)
|
423 |
image_url = response.data[0].url
|
424 |
img_response = requests.get(image_url)
|