Initial commit
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
PROMPT="$1"
|
||||
SERVER_IP="192.168.2.154"
|
||||
API_URL="http://${SERVER_IP}:5005/v1/images/generations"
|
||||
|
||||
# Note: Using "flux-schnell" to match our api.py logic
|
||||
RESPONSE=$(curl -s -X POST "$API_URL" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{
|
||||
\"prompt\": \"$PROMPT\",
|
||||
\"model\": \"flux-schnell\"
|
||||
}")
|
||||
|
||||
BASE64=$(echo "$RESPONSE" | jq -r '.data[0].b64_json')
|
||||
|
||||
if [ "$BASE64" == "null" ]; then
|
||||
echo "Error: $(echo "$RESPONSE" | jq -r .detail)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OUTDIR="downloads/flux_images"
|
||||
mkdir -p "$OUTDIR"
|
||||
OUTFILE="${OUTDIR}/$(date +%s).png"
|
||||
|
||||
echo "$BASE64" | base64 -d > "$OUTFILE"
|
||||
echo "Image generated: $OUTFILE"
|
||||
Reference in New Issue
Block a user