1e51ef7def
- Konzept/, didaktik_geografie/, didaktik_simulation/, v2-modules/, v2-platform/ - 12 code-workspace-Files - STATUS-*.md - viele M/D/R-Änderungen an bereits getrackten Files - .gitignore verstärkt: **/.humaninput/, **/secret_keys.txt Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
124 lines
10 KiB
Bash
124 lines
10 KiB
Bash
#!/usr/bin/env bash
|
||
# GeoGraSim — Neue Avatar-PNGs (42 Stück) generieren.
|
||
#
|
||
# Verwendet die OpenAI Images API. DALL-E-3 ist im Account nicht mehr verfügbar;
|
||
# probiert daher zuerst gpt-image-1 (1024×1024). Bei Erfolg landen die PNGs in
|
||
# App/assets/img/avatars/. Anschließend bitte build-avatar-thumbs.ps1 ausführen,
|
||
# damit die Webp-Thumbs entstehen.
|
||
#
|
||
# Aufruf:
|
||
# set -a; source App/.env.local; set +a
|
||
# bash App/assets/img/avatars/scripts/generate-new-avatars.sh
|
||
# Mit FORCE=1 werden bestehende Avatare überschrieben.
|
||
|
||
set -e
|
||
: "${OPENAI_API_KEY:?OPENAI_API_KEY in App/.env.local fehlt}"
|
||
|
||
DEST="$(cd "$(dirname "$0")/.." && pwd)"
|
||
cd "$DEST"
|
||
|
||
STYLE='Flat Scandinavian portrait illustration, circular composition, painted style with clean vector shapes, dark forest green (#1f4b37) and sage green (#4a7c4e) tones, yellow-mustard (#e8c547) accents, beige (#e8e4d8) backgrounds, white highlights. Friendly, character-focused portrait, centered face, soft shoulder framing, plain background. No text, no watermark, no logo, no borders, no frame.'
|
||
|
||
# slug|prompt-suffix
|
||
read -r -d '' SPECS << 'EOF' || true
|
||
ozeanographin|Portrait of a young female oceanographer named Linnea, Scandinavian features, wearing a navy blue research-vessel jacket with a small whale-tail brooch, holding a clipboard, soft sunlit ocean background suggested.
|
||
tropenbiologe|Portrait of a young male tropical biologist named Kwame, West African features, wearing an olive field shirt, a brass magnifier on a lanyard, leaves and a colorful tropical bird suggested in the background.
|
||
skaterin|Portrait of a young female skater named Reni, multi-ethnic, short pink hair, beanie cap, skateboard slung over her shoulder, neutral urban background.
|
||
dj|Portrait of a young male DJ named Kofi, West African features, wireless headphones around the neck, casual yellow hoodie, mixing board hint in the background.
|
||
wolf-tundra|Portrait of a friendly tundra wolf cub named Yuki, white-gray fur, blue eyes, sitting in fresh snow, gentle smile, soft Arctic-light background.
|
||
krake-tiefsee|Portrait of a friendly deep-sea octopus named Otto, purple-pink skin, large curious eyes, two arms gently waving, soft underwater glow background.
|
||
|
||
alien-geologin|Portrait of a friendly humanoid alien geologist named Zorblax from planet Geo-7, lavender skin, three glowing eyes, holding a quartz crystal, small antennae, soft cosmic background.
|
||
alien-ozean|Portrait of a friendly humanoid alien oceanographer named Aquana from planet Aqualon, teal-blue translucent skin, fish-like gills on the neck, holding a glowing water-sample tube.
|
||
alien-wetter|Portrait of a friendly humanoid alien meteorologist named Tempest from planet Nimbus, cloud-gray skin, tiny lightning bolts around the head, holding a small cloud in the palm.
|
||
alien-stadt|Portrait of a friendly humanoid alien urban analyst named Urbanix from planet Metropolis-9, silver-mint skin, geometric city-pattern markings on the cheeks, holding a holographic city model.
|
||
alien-tiere|Portrait of a friendly humanoid alien biologist named Faunor from planet Zoonia, sand-yellow fur, friendly cat-like ears, holding a small alien butterfly.
|
||
alien-pflanzen|Portrait of a friendly humanoid alien botanist named Floranth from planet Verdantis, leaf-green skin, tiny flowers growing from the hair, holding a curious sprouting seed.
|
||
alien-vulkan|Portrait of a friendly humanoid alien volcanologist named Magmara from planet Pyrox, warm orange-red skin, glowing seams like cooling lava on the arms, holding a small obsidian stone.
|
||
alien-arktis|Portrait of a friendly humanoid alien glaciologist named Glacium from planet Kryonia, pale ice-blue skin, frost patterns on the shoulders, holding a small glowing ice core.
|
||
alien-wueste|Portrait of a friendly humanoid alien desert researcher named Solara from planet Helios, golden-tan skin, sun-disc headpiece, holding a tiny cactus.
|
||
alien-regenwald|Portrait of a friendly humanoid alien rainforest scout named Veridia from planet Chlora, jade-green skin, vine-like hair, small parrot on shoulder.
|
||
alien-berg|Portrait of a friendly humanoid alien mountaineer named Altimos from planet Alpinis, stone-gray skin, geological strata pattern on the cheeks, holding a compass.
|
||
alien-meer|Portrait of a friendly humanoid alien ocean explorer named Marinus from planet Pelagos, deep blue skin, coral-like crown, holding a glowing seashell.
|
||
|
||
bathyscaph-trieste|Portrait of the Trieste bathyscaph, a deep-sea submersible from 1960 used by Jacques Piccard and Don Walsh to reach the Mariana Trench, viewed from the front, sturdy steel sphere with portholes, deep ocean blue background, technical illustration style matching the project.
|
||
zeppelin-graf|Portrait of the Graf Zeppelin airship from 1929, viewed from the side, silver fabric envelope with crew gondola, gentle clouds and earth horizon in the background.
|
||
ballon-charliere|Portrait of the Charlière hydrogen balloon from 1783, brown wicker basket beneath a beige spherical envelope with rope netting, calm sky with golden sunset.
|
||
polar-fram|Portrait of the polar research vessel Fram from Fridtjof Nansen 1893, wooden hull designed to drift in pack ice, sails furled, surrounded by drift ice and gentle northern light.
|
||
dampfschiff-beagle|Portrait of HMS Beagle from Charles Darwin 1831, three-masted brig with steam funnel, anchored at a tropical island shore, palm silhouettes in the background.
|
||
tauchglocke-halley|Portrait of Halley diving bell from 1690, wooden barrel-shaped chamber with weighted base, suspended underwater by ropes, fish silhouettes around.
|
||
sonde-voyager|Portrait of Voyager 1 space probe from 1977, golden record disc visible, parabolic dish antenna, against deep starfield background with Jupiter silhouette.
|
||
eisbohrer-vostok|Portrait of a Vostok ice-core sample being lifted from a Antarctic drill, scientists in red parkas in the background, clear ice cylinder with visible compression layers, soft polar light.
|
||
rover-curiosity|Portrait of the Curiosity Mars rover from 2012, six wheels, robotic arm extended, mast camera, on red Martian terrain with butte in the background.
|
||
satellit-landsat|Portrait of a Landsat earth-observation satellite, large solar panel arrays extended like wings, viewed orbiting Earth, blue planet in the background.
|
||
forschungsschiff-meteor|Portrait of FS Meteor research vessel, white hull with German flag, scientific equipment on deck, calm sea, distant horizon.
|
||
wettersatellit-meteosat|Portrait of a Meteosat geostationary weather satellite, cylindrical shape with solar cells, viewed against Earth from high orbit with European weather patterns visible.
|
||
|
||
humboldt-alexander|Portrait of Alexander von Humboldt (1769-1859), classic European scholar in formal early-19th-century coat, holding a botanical sample, gentle Andean landscape background.
|
||
mercator-gerhard|Portrait of Gerhard Mercator (1512-1594), Flemish cartographer in Renaissance clothing with beard, holding a globe and pair of compasses.
|
||
cook-james|Portrait of Captain James Cook (1728-1779), British naval officer in 18th-century uniform, tricorn hat, Pacific island in the background.
|
||
polo-marco|Portrait of Marco Polo (1254-1324), young Venetian merchant in medieval traveling clothes, holding a small jade figurine, hint of the Silk Road in background.
|
||
ibn-battuta|Portrait of Ibn Battuta (1304-1369), Moroccan scholar-traveler in traditional robes and turban, holding a travel journal, suggestion of desert and minaret.
|
||
nansen-fridtjof|Portrait of Fridtjof Nansen (1861-1930), Norwegian polar explorer in fur-trimmed parka, ice-axe in hand, polar light background.
|
||
piccard-auguste|Portrait of Auguste Piccard (1884-1962), Swiss physicist with characteristic large forehead and round glasses, wearing a vintage flight suit, stratosphere balloon in background.
|
||
amundsen-roald|Portrait of Roald Amundsen (1872-1928), Norwegian polar explorer in fur parka with hood, holding the Norwegian flag, Antarctic ice horizon.
|
||
earhart-amelia|Portrait of Amelia Earhart (1897-1937), American aviator in leather flight jacket and aviator goggles pushed up, short tousled hair, vintage propeller plane in background.
|
||
earle-sylvia|Portrait of Sylvia Earle (born 1935), American marine biologist in diving suit holding helmet under arm, ocean reef in background, white wavy hair, warm smile.
|
||
anning-mary|Portrait of Mary Anning (1799-1847), English paleontologist in 19th-century shawl and bonnet, holding an ammonite fossil, Jurassic coast cliffs behind.
|
||
carson-rachel|Portrait of Rachel Carson (1907-1964), American environmental scientist with notebook and binoculars, gentle pastoral background suggesting nature.
|
||
EOF
|
||
|
||
count_total=0; count_done=0; count_skip=0; count_fail=0
|
||
|
||
# Bash here-string read loop
|
||
echo "$SPECS" | while IFS='|' read -r slug suffix; do
|
||
[ -z "$slug" ] && continue
|
||
count_total=$((count_total+1))
|
||
out="avatar-${slug}.png"
|
||
if [ -f "$out" ] && [ -z "$FORCE" ]; then
|
||
echo "skip $out (existiert; FORCE=1 zum Überschreiben)"
|
||
count_skip=$((count_skip+1))
|
||
continue
|
||
fi
|
||
prompt="$STYLE $suffix"
|
||
echo "-> generiere $out"
|
||
|
||
# gpt-image-1 zuerst probieren (DALL-E-3 ist im Account weg)
|
||
payload=$(PROMPT="$prompt" python -c 'import json,os; print(json.dumps({"model":"gpt-image-1","prompt":os.environ["PROMPT"],"n":1,"size":"1024x1024","quality":"medium"}))')
|
||
resp=$(curl -s https://api.openai.com/v1/images/generations \
|
||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||
-H "Content-Type: application/json" \
|
||
-d "$payload")
|
||
b64=$(echo "$resp" | python -c 'import sys,json
|
||
try: print(json.load(sys.stdin).get("data",[{}])[0].get("b64_json",""))
|
||
except: print("")' 2>/dev/null)
|
||
if [ -z "$b64" ]; then
|
||
url=$(echo "$resp" | python -c 'import sys,json
|
||
try: print(json.load(sys.stdin).get("data",[{}])[0].get("url",""))
|
||
except: print("")' 2>/dev/null)
|
||
if [ -n "$url" ]; then
|
||
curl -s "$url" -o "$out"
|
||
if [ -s "$out" ]; then
|
||
echo " ok $out ($(du -h "$out" | cut -f1))"
|
||
count_done=$((count_done+1))
|
||
sleep 2
|
||
continue
|
||
fi
|
||
fi
|
||
err=$(echo "$resp" | python -c 'import sys,json
|
||
try: print(json.load(sys.stdin).get("error",{}).get("message","?"))
|
||
except: print("unparseable")' 2>/dev/null)
|
||
echo " fail $out: $err"
|
||
count_fail=$((count_fail+1))
|
||
continue
|
||
fi
|
||
echo "$b64" | base64 -d > "$out"
|
||
echo " ok $out ($(du -h "$out" | cut -f1))"
|
||
count_done=$((count_done+1))
|
||
sleep 2
|
||
done
|
||
|
||
echo ""
|
||
echo "Avatar-Generator fertig."
|
||
echo "Anschließend bitte: powershell -ExecutionPolicy Bypass -File 'App\\Don_t_Deploy\\build-avatar-thumbs.ps1'"
|