This project is a simple Flask web application that generates anime-style images using a Deep Convolutional Generative Adversarial Network (DCGAN). The application loads a pre-trained generator model, generates an image based on random noise, and serves the image via a web interface.
- DCGAN Model Integration: The application uses a TensorFlow/Keras model (
DCGEN.h5) to generate anime-style images. - Flask Web Interface: Provides a simple web interface where users can generate images.
- Image Generation and Serving: Images are generated dynamically and served directly to the user.
Before running the application, ensure you have the following installed:
- Python 3.x
- Flask
- TensorFlow
- Pillow (PIL)
-
Clone the repository:
git clone https://github.com/yourusername/anime-generator.git cd anime-generator -
Install the required Python packages:
pip install Flask tensorflow pillow
-
Ensure the pre-trained generator model
DCGEN.h5is located in the root directory of the project. -
Create a
staticfolder in the project directory to store the generated images:mkdir static
-
Run the Flask application:
python app.py
-
Open your web browser and go to
http://127.0.0.1:5000/to access the application. -
Click on the "Generate" button to create and view a new anime-style image.
app.py: The main Flask application script.DCGEN.h5: The pre-trained DCGAN generator model.templates/index.html: HTML file for the web interface.static/: Directory where generated images are stored temporarily.
-
Loading the Model: The pre-trained generator model (
DCGEN.h5) is loaded when the Flask application starts. -
Generating an Image: When a user navigates to the
/generateroute, the application generates random noise, feeds it into the DCGAN generator, and produces an image. -
Serving the Image: The generated image is saved as
generated_image.pngin thestatic/directory and is served to the user as a PNG file.
- Model Not Found: Ensure the
DCGEN.h5file is in the correct directory. - Port Issues: If the default port
5000is in use, you can specify a different port by modifying theapp.run()line inapp.py.
This project is licensed under the MIT License. See the LICENSE file for more details.