- Live Demo: https://text-to-img-g6pi.onrender.com/
- Source Code: https://github.com/shivansh090/Ai-Image-Generator
✨ Features
- AI-Powered Image Generation: Generate stunning images using text prompts powered by Stability AI's Stable Diffusion XL 1.0.
- Community Gallery: Browse and explore a gallery of AI-generated images shared by the community.
- Share Creations: Share your own AI-generated images with others.
- Responsive Design: Optimized for both desktop and mobile devices for seamless use.
Tech Stack
-
Frontend
- React with Vite
- Tailwind CSS for styling
-
Backend
- Node.js with Express
- MongoDB for data storage
- Cloudinary for image hosting
- Hugging Face API for accessing AI models
-
Authentication
- JWT (JSON Web Tokens)
How to Run
-
Backend Setup:
- Navigate to the server directory:
cd server
- Install dependencies:
npm install
- Start the backend server:
node index.js
- Navigate to the server directory:
-
Frontend Setup:
- Navigate to the client directory:
cd client
- Install dependencies:
npm install
- Start the frontend server:
npm run dev
- Navigate to the client directory:
- Open your browser and navigate to
http://localhost:5173
.
API Endpoints
GET /api/v1/post
: Fetch all posts.POST /api/v1/post
: Create a new post.POST /api/v1/dalle
: Generate an image from a text prompt.
Environment Variables
Set up the following in your .env
file:
MONGODB_URL=your_mongodb_connection_string
OPENAI_API_KEY=your_openai_api_key
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
HUGGING_FACE_API=your_hugging_face_api_key
Acknowledgements
- Stability AI for Stable Diffusion
- Hugging Face for AI model access
- Cloudinary for image hosting
- MERN stack community for their resources
Hope you enjoy creating with the AI Image Generator App! Don’t forget to star it on GitHub if you find it helpful. 🚀