Organized the application into separate frontend and backend directories for cleaner deployment and better separation of concerns. Frontend Directory (frontend/): - index.html: Single-page web interface (renamed from web_ui.html) - README.md: Frontend deployment guide - Total size: ~113 KB (self-contained) - Smart base path detection (works at / or /ai_qc/) - No configuration changes required Backend Directory (backend/): - All Python files (api_server.py, llm_config.py, etc.) - visual_qc_apps/: 33 QC check modules - profiles/: 6 QC profile configurations - brand_guidelines/: Reference asset storage - config/: Environment configurations - scripts/: Deployment automation - uploads/, output/: Data directories - requirements.txt, ai_qc.service, apache_config.conf - Complete documentation New Documentation: - FOLDER_STRUCTURE.md: Comprehensive guide to new structure - frontend/README.md: Frontend deployment instructions - backend/BACKEND_README.md: Backend deployment guide Deployment Mapping: - frontend/ → /var/www/html/ai_qc/ (web root) - backend/ → /opt/ai_qc/ (application directory) Benefits: - Clear separation of concerns - Backend code not in web-accessible directory - Independent frontend/backend updates - Matches server's existing patterns (/opt/veo3, /opt/voice2text) - Industry-standard architecture - Easy to deploy and maintain Original files preserved in root directory for reference. Ready for production deployment following MIGRATION_GUIDE.md. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
84 lines
No EOL
2.8 KiB
Bash
Executable file
84 lines
No EOL
2.8 KiB
Bash
Executable file
#!/bin/bash
|
||
# Visual AI QC - Headless Operation with cURL Examples
|
||
|
||
API_BASE="http://localhost:7183"
|
||
IMAGE_FILE="path/to/your/image.jpg"
|
||
|
||
echo "🤖 Visual AI QC - Headless cURL Examples"
|
||
echo "========================================"
|
||
|
||
# 1. Get available profiles
|
||
echo -e "\n📋 1. Get Available Profiles:"
|
||
curl -s "$API_BASE/api/profiles" | python -m json.tool
|
||
|
||
# 2. Get reference assets
|
||
echo -e "\n📁 2. Get Reference Assets:"
|
||
curl -s "$API_BASE/api/brand_guidelines" | python -m json.tool
|
||
|
||
# 3. Start async analysis
|
||
echo -e "\n🔍 3. Start Analysis (Update IMAGE_FILE path first!):"
|
||
echo "curl -X POST -F \"file=@$IMAGE_FILE\" \\"
|
||
echo " -F \"profile=diageo_key_visual\" \\"
|
||
echo " -F \"mode=json\" \\"
|
||
echo " -F \"reference_asset=Hellmanns_20250805_113413\" \\"
|
||
echo " \"$API_BASE/api/start_analysis\""
|
||
|
||
# Example response parsing
|
||
echo -e "\n# Example: Parse session ID and track progress"
|
||
echo "SESSION_ID=\$(curl -s -X POST -F \"file=@$IMAGE_FILE\" -F \"profile=diageo_key_visual\" \"$API_BASE/api/start_analysis\" | jq -r '.session_id')"
|
||
echo "echo \"Session ID: \$SESSION_ID\""
|
||
|
||
# 4. Check progress
|
||
echo -e "\n⏳ 4. Check Analysis Progress:"
|
||
echo "curl -s \"$API_BASE/api/progress/\$SESSION_ID\" | python -m json.tool"
|
||
|
||
# 5. Simple direct analysis (no progress tracking)
|
||
echo -e "\n🚀 5. Simple Direct Analysis:"
|
||
echo "curl -X POST -F \"file=@$IMAGE_FILE\" \\"
|
||
echo " -F \"profile=general_key_visual\" \\"
|
||
echo " -F \"mode=json\" \\"
|
||
echo " \"$API_BASE/api/analyze\" | python -m json.tool"
|
||
|
||
# 6. Brand detection
|
||
echo -e "\n🏷️ 6. Brand Detection:"
|
||
echo "curl -X POST -F \"file=@$IMAGE_FILE\" \\"
|
||
echo " \"$API_BASE/api/detect_brand\" | python -m json.tool"
|
||
|
||
# 7. List output files
|
||
echo -e "\n📄 7. List Generated Files:"
|
||
curl -s "$API_BASE/api/output_files" | python -m json.tool
|
||
|
||
# 8. Complete workflow example
|
||
echo -e "\n🔄 8. Complete Workflow Script:"
|
||
cat << 'EOF'
|
||
#!/bin/bash
|
||
# Complete headless analysis workflow
|
||
|
||
IMAGE="your_image.jpg"
|
||
API="http://localhost:7183"
|
||
|
||
# Start analysis
|
||
RESPONSE=$(curl -s -X POST -F "file=@$IMAGE" -F "profile=diageo_key_visual" -F "mode=json" "$API/api/start_analysis")
|
||
SESSION_ID=$(echo $RESPONSE | jq -r '.session_id')
|
||
|
||
echo "Analysis started: $SESSION_ID"
|
||
|
||
# Poll for completion
|
||
while true; do
|
||
PROGRESS=$(curl -s "$API/api/progress/$SESSION_ID")
|
||
STAGE=$(echo $PROGRESS | jq -r '.progress.stage')
|
||
|
||
if [ "$STAGE" = "complete" ]; then
|
||
echo "Analysis complete!"
|
||
echo $PROGRESS | jq '.progress.result.summary'
|
||
break
|
||
else
|
||
CURRENT=$(echo $PROGRESS | jq -r '.progress.current_check_display')
|
||
PERCENT=$(echo $PROGRESS | jq -r '.progress.percentage')
|
||
echo "Progress: $PERCENT% - $CURRENT"
|
||
sleep 2
|
||
fi
|
||
done
|
||
EOF
|
||
|
||
echo -e "\n✅ All examples ready! Update IMAGE_FILE path and run." |