📚 Documentation + scripts from today's exploration
- ASSET_COUNT_STATUS_01_01_2026.md - asset tracking - CHARACTER_PRODUCTION_PLAN.md - character animation plan - CHARACTER_GENERATION_FINAL_PLAN.md - API alternatives research - COMFYUI_SETUP_TODAY.md - ComfyUI setup guide - TASKS_01_01_2026.md - consolidated task list - FULL_STORY_OVERVIEW.md - game narrative summary - preview_animations.html - animation preview gallery - Test scripts for API exploration (test_minimal.py, test_imagen.py) - Character generation scripts (generate_all_characters_complete.py, generate_characters_working.py) These were created during API troubleshooting and production planning.
This commit is contained in:
68
scripts/test_minimal.py
Normal file
68
scripts/test_minimal.py
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
MINIMAL TEST - Generate ONE image
|
||||
"""
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
import base64
|
||||
from PIL import Image
|
||||
import io
|
||||
|
||||
API_KEY = os.getenv('GEMINI_API_KEY')
|
||||
print(f"✅ API Key: {API_KEY[:15]}...")
|
||||
|
||||
API_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:generateContent"
|
||||
|
||||
prompt = """Dark Hand-Drawn 2D Stylized Indie Game Art.
|
||||
Character: KAI - Green & Pink dreadlocks, tactical outfit, age 17.
|
||||
Animation: Walking toward camera, frame 1 of 4, front view.
|
||||
Bold black outlines, centered, transparent background."""
|
||||
|
||||
print(f"\n🎨 Generating test image...")
|
||||
print(f"Prompt: {prompt[:80]}...\n")
|
||||
|
||||
payload = {
|
||||
"contents": [{
|
||||
"parts": [{
|
||||
"text": prompt
|
||||
}]
|
||||
}]
|
||||
}
|
||||
|
||||
headers = {"Content-Type": "application/json"}
|
||||
url = f"{API_URL}?key={API_KEY}"
|
||||
|
||||
print(f"📡 Calling API...")
|
||||
response = requests.post(url, headers=headers, json=payload, timeout=60)
|
||||
|
||||
print(f"Status: {response.status_code}")
|
||||
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
print(f"✅ Response received!")
|
||||
print(f"Keys: {list(data.keys())}")
|
||||
|
||||
if 'candidates' in data:
|
||||
print(f"Candidates: {len(data['candidates'])}")
|
||||
|
||||
for i, cand in enumerate(data['candidates']):
|
||||
print(f"\nCandidate {i}:")
|
||||
if 'content' in cand:
|
||||
print(f" Content keys: {list(cand['content'].keys())}")
|
||||
if 'parts' in cand['content']:
|
||||
print(f" Parts: {len(cand['content']['parts'])}")
|
||||
for j, part in enumerate(cand['content']['parts']):
|
||||
print(f" Part {j} keys: {list(part.keys())}")
|
||||
if 'inlineData' in part:
|
||||
print(f" ✅ Found image data!")
|
||||
image_b64 = part['inlineData']['data']
|
||||
image_bytes = base64.b64decode(image_b64)
|
||||
image = Image.open(io.BytesIO(image_bytes))
|
||||
|
||||
output_path = "assets/slike/TEST_kai_walk_frame1.png"
|
||||
image.save(output_path, "PNG")
|
||||
print(f" ✅✅ Saved to: {output_path}")
|
||||
else:
|
||||
print(f"❌ Error: {response.text}")
|
||||
print("\n✅ Test complete!")
|
||||
Reference in New Issue
Block a user