File size: 2,260 Bytes
3e702d7
7f1fe9e
548d4a4
3e702d7
 
 
 
 
 
 
 
44dcf98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
title: Bedtime Stories
emoji: 🧙🏼‍♂️
colorFrom: gray
colorTo: blue
sdk: gradio
sdk_version: 4.39.0
app_file: app.py
pinned: false
---

# Bedtime Stories Generator

This project is an AI-powered Children Story Generator that creates unique stories based on uploaded images. It uses image captioning and large language models to generate engaging stories for children.

## Features

- Upload an image to generate a story
- Choose from multiple language models for story generation
- User interface built with Gradio
- Handles various image formats

## Tech Stack

- Python
- Gradio for the web interface
- Hugging Face Transformers for image captioning
- LangChain for interfacing with language models
- PIL (Python Imaging Library) for image processing

## Installation

1. Clone this repository:
   ```
   git clone https://github.com/yourusername/kids-story-generator.git
   cd kids-story-generator
   ```

2. Install the required dependencies:
   ```
   pip install -r requirements.txt
   ```

## Usage

1. Run the application:
   ```
   python app.py
   ```

2. Open your web browser and navigate to the URL provided in the terminal (usually `http://localhost:7860`).

3. Upload an image or use one of the provided examples.

4. Select a language model from the dropdown menu.

5. Click "Submit" to generate a story based on the image.

## Deploying to Hugging Face Spaces

This project is designed to be easily deployed to Hugging Face Spaces. To deploy:

1. Create a new Space on Hugging Face.
2. Connect your GitHub repository to the Space.
3. Make sure all files, including the `assets` folder with example images, are included in your repository.
4. Set the Space SDK to "Gradio".
5. The `requirements.txt` file should automatically install all necessary dependencies.

## Project Structure

- `app.py`: Main application file with Gradio interface
- `brain.py`: Contains the `StoryGenerator` class with core functionality
- `assets/`: Folder containing example images
- `requirements.txt`: List of Python dependencies

## Contributing

Contributions to improve the project are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.