AI Photo Pro is a modern, web-based photo editing application that leverages the power of Google's Gemini AI to analyze, enhance, and apply professional styles to your images. Built with React, TypeScript, and Tailwind CSS, this app provides a seamless and intuitive user experience.
- AI-Powered Image Analysis: Automatically detects image quality, including resolution, sharpness, lighting, and flaws.
- High-Resolution Enhancement: Instantly upgrades your photos to a higher resolution, improving clarity and detail.
- One-Click Professional Styling: Apply a variety of professional styles like "DSLR Quality", "Cinematic", or "Vintage Film".
- Custom Style Prompts: Describe any style you can imagine, and the AI will apply it to your photo.
- Intuitive Interface: A simple drag-and-drop uploader and a clear, step-by-step editing process.
- Responsive Design: Looks and works great on all devices, from desktops to mobile phones.
- Frontend: React 18, TypeScript
- Styling: Tailwind CSS
- AI Model: Google Gemini (
gemini-2.5-flash-image) via@google/genaiSDK
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
This application requires a Google Gemini API key to function.
- Go to the Google AI Studio.
- Sign in with your Google account.
- Click on the "Get API key" button on the top left.
- Click "Create API key in new project".
- Copy the generated API key. Keep this key secure and do not share it publicly.
Prerequisites:
- Node.js (version 18 or later recommended)
npmoryarnpackage manager
Installation:
-
Clone the repository (or download the source files):
git clone https://github.com/your-username/ai-photo-pro.git cd ai-photo-pro -
Install dependencies: The necessary dependencies are listed in
dependencies.json. To install them, you would typically run:# Using npm npm install @google/genai react react-dom npm install -D @types/react @types/react-dom typescript # Or using yarn yarn add @google/genai react react-dom yarn add -D @types/react @types/react-dom typescript
-
Create an environment file: Copy the example environment file
.env.exampleto a new file named.env.local.cp .env.example .env.local
Open
.env.localin your text editor and paste your Google Gemini API key:# .env.local API_KEY="YOUR_GOOGLE_GEMINI_API_KEY_HERE"Note: If you are using Create React App, your variable must be prefixed with
REACT_APP_. For Vite, it must beVITE_. The code usesprocess.env.API_KEY, assuming the build tool is configured to replace this.
Once the setup is complete, you can run the development server.
# Using npm
npm start
# Or using yarn
yarn startThis will start the application, and you can access it in your browser, usually at http://localhost:3000.
This is a client-side React application. To deploy it, you need to build the static files and host them on a static hosting provider.
Run the build command to generate a build or dist folder containing the optimized static assets.
# Using npm
npm run build
# Or using yarn
yarn buildYou can deploy the contents of the generated build (or dist) folder to any static hosting service.
Important Note on API Keys: Since this is a client-side app, your API_KEY will be exposed in the browser. For a production application, you should create a backend server (e.g., using Node.js/Express) that acts as a proxy to the Gemini API. The client would make requests to your backend, and your backend would securely call the Gemini API with your key. However, for personal projects or demos, client-side usage is simpler.
- Push your code to a GitHub repository.
- Go to the Render Dashboard and click "New +" -> "Static Site".
- Connect your GitHub repository.
- Configure the settings:
- Build Command:
npm run build(oryarn build) - Publish Directory:
build(ordist)
- Build Command:
- Add your environment variable:
- Click on the "Environment" tab.
- Add a secret file or environment variable with the key
API_KEYand your Gemini API key as the value. Your build tool must be configured to use this at build time.
- Click "Create Static Site". Render will automatically build and deploy your site.
The process is very similar for Vercel and Netlify.
- Connect your Git repository.
- They will likely auto-detect that it's a React project.
- Set the build command and publish directory if they aren't detected correctly.
- Go to the project's settings and add your
API_KEYas an environment variable. - Deploy.
- Build the application as described above.
- Copy the contents of the
build(ordist) folder to your server. - Use a web server like Nginx or Apache to serve the static files.
Example Nginx Configuration:
Create a new server block configuration file (e.g., /etc/nginx/sites-available/ai-photo-pro):
server {
listen 80;
server_name your-domain.com; # or your server's IP address
root /var/www/ai-photo-pro; # Path to your build files
index index.html;
location / {
try_files $uri /index.html;
}
}Enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/ai-photo-pro /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginxThis will make your application accessible over your local network (using the server's local IP) or the internet (if configured with a domain).