A web application for processing images through Google's Gemini API using custom prompt sets. Upload two images, apply a sequence of prompts, and see all intermediate results.
- Prompt Set Management: Create, edit, and delete prompt sets (1-25 prompts per set)
- Dual Image Processing: Upload two images and process them together with the first prompt
- Sequential Processing: Each subsequent prompt processes the result from the previous step
- Visual Results: Display all intermediate results in a clean, modern interface
- Local Storage: Uses SQLite for storing prompt sets
- No Authentication: Simple single-user setup for local development
- Node.js (v14 or higher)
- npm or yarn
- Google Gemini API key
-
Clone or navigate to the project directory
cd app_multipicture -
Install dependencies
npm install
-
Configure the API key
- Copy the example config file:
cp config.example.json config.json
- Edit
config.jsonand add your Gemini API key:{ "geminiApiKey": "YOUR_ACTUAL_API_KEY_HERE", "port": 3000 }
- Copy the example config file:
- Go to Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key and paste it into your
config.jsonfile
-
Start the server
npm start
For development with auto-restart:
npm run dev
-
Open your browser Navigate to:
http://localhost:3000
- Click on the Config link in the navigation
- Click Create New Set
- Enter a name for your prompt set
- Add prompts (1-25) by clicking Add Prompt
- Enter the text for each prompt
- Click Save
- Go to the Main Page
- Upload two images using the file inputs
- Select a prompt set from the dropdown
- Click Process Images
- Wait for the processing to complete
- View all intermediate results
- First Prompt: Applied to both uploaded images simultaneously
- Subsequent Prompts: Each prompt is applied to the result from the previous step
- Results Display: All intermediate results are shown in sequence
app_multipicture/
├── server.js # Express backend server
├── package.json # Node.js dependencies
├── config.json # API configuration (create from example)
├── config.example.json # Configuration template
├── prompts.db # SQLite database (auto-created)
├── public/ # Frontend files
│ ├── index.html # Main page
│ ├── config.html # Config page
│ ├── main.js # Main page logic
│ ├── config.js # Config page logic
│ └── styles.css # Shared styles
└── uploads/ # Temporary image storage (auto-created)
GET /api/prompt-sets- Get all prompt setsGET /api/prompt-sets/:id- Get a specific prompt setPOST /api/prompt-sets- Create a new prompt setPUT /api/prompt-sets/:id- Update a prompt setDELETE /api/prompt-sets/:id- Delete a prompt set
POST /api/process-images- Process images with a prompt set- Body: FormData with
images(2 files) andpromptSetId
- Body: FormData with
-
Update API URL: In
public/main.jsandpublic/config.js, change:const API_URL = 'http://localhost:3000/api';
to your production URL:
const API_URL = 'https://yourdomain.com/api';
-
Set production port: Update
config.jsonif needed -
Secure your API key: Use environment variables in production:
const apiKey = process.env.GEMINI_API_KEY || config.geminiApiKey;
- Upload all files to your hosting server
- Install Node.js dependencies on the server
- Set up the API key configuration
- Configure your hosting to run
node server.jsas a service - Set up a reverse proxy (nginx/Apache) to route traffic to the Node.js server
- Ensure the server has write permissions for the database and uploads folder
server {
listen 80;
server_name yourdomain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}- Make sure you've created
config.jsonfromconfig.example.json - Verify your Gemini API key is correct
- Check if port 3000 is already in use
- Delete
prompts.dband restart the server to recreate the database - Ensure the application has write permissions in the directory
- Verify your Gemini API key is valid and has credits
- Check the console for error messages
- Ensure the uploaded images are in a supported format
- Make sure the frontend is accessing the correct API URL
- In production, update CORS settings in
server.jsif needed
- The current implementation uses the Gemini Pro Vision model
- Image processing may take several seconds per prompt
- Large images will be uploaded and may take time to process
- The
uploads/folder stores temporary files that are cleaned up after processing
- Support for more than 2 initial images
- Download processed results
- Progress indicators for each prompt
- Batch processing multiple image sets
- User authentication and multi-user support
- Image result caching
ISC