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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ๐ง Prompt Engine
|
| 2 |
+
|
| 3 |
+
A powerful AI-based system that converts **text, image, and audio inputs** into **high-quality, structured prompts** for generative AI models like Stable Diffusion, Midjourney, and DALLยทE.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## ๐ Features
|
| 8 |
+
|
| 9 |
+
* โ๏ธ **Text โ Prompt**
|
| 10 |
+
Refines and extends simple prompts into detailed, high-quality prompts.
|
| 11 |
+
|
| 12 |
+
* ๐ผ๏ธ **Image + Text โ Prompt**
|
| 13 |
+
Understands an image and user intent to generate a descriptive prompt.
|
| 14 |
+
|
| 15 |
+
* ๐ง **Audio โ Prompt**
|
| 16 |
+
Converts speech into text and then generates a refined prompt.
|
| 17 |
+
|
| 18 |
+
* ๐ง **Multimodal AI (Janus-Pro-1B)**
|
| 19 |
+
Uses a vision-language model for intelligent prompt generation.
|
| 20 |
+
|
| 21 |
+
* ๐จ **Gradio UI**
|
| 22 |
+
Interactive web interface for easy usage.
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## ๐งฉ Architecture
|
| 27 |
+
|
| 28 |
+
```
|
| 29 |
+
Input (Text / Image / Audio)
|
| 30 |
+
โ
|
| 31 |
+
Preprocessing Layer
|
| 32 |
+
(Whisper for audio)
|
| 33 |
+
โ
|
| 34 |
+
Instruction Builder (Prompt Engineering)
|
| 35 |
+
โ
|
| 36 |
+
Janus-Pro-1B Model
|
| 37 |
+
โ
|
| 38 |
+
Post-processing (clean output)
|
| 39 |
+
โ
|
| 40 |
+
Final AI Prompt
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
---
|
| 44 |
+
|
| 45 |
+
## ๐ ๏ธ Tech Stack
|
| 46 |
+
|
| 47 |
+
* **Python**
|
| 48 |
+
* **HuggingFace Transformers**
|
| 49 |
+
* **DeepSeek Janus-Pro-1B**
|
| 50 |
+
* **OpenAI Whisper (Speech-to-Text)**
|
| 51 |
+
* **Gradio (UI)**
|
| 52 |
+
* **PyTorch**
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## ๐ฆ Installation
|
| 57 |
+
|
| 58 |
+
### 1. Clone the repository
|
| 59 |
+
|
| 60 |
+
```bash
|
| 61 |
+
git clone https://github.com/your-username/prompt-generator.git
|
| 62 |
+
cd prompt-generator
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
---
|
| 66 |
+
|
| 67 |
+
### 2. Install dependencies
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
pip install -r requirements.txt
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
---
|
| 74 |
+
|
| 75 |
+
### 3. Run the application
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
python app.py
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
---
|
| 82 |
+
|
| 83 |
+
## ๐งช Usage
|
| 84 |
+
|
| 85 |
+
1. Open the Gradio UI in your browser
|
| 86 |
+
2. Select input type:
|
| 87 |
+
|
| 88 |
+
* Text
|
| 89 |
+
* Image + Text
|
| 90 |
+
* Audio
|
| 91 |
+
3. Provide input
|
| 92 |
+
4. Click **Generate Prompt ๐**
|
| 93 |
+
5. Get your refined AI prompt
|
| 94 |
+
|
| 95 |
---
|
| 96 |
+
|
| 97 |
+
## ๐ง Example
|
| 98 |
+
|
| 99 |
+
### Input:
|
| 100 |
+
|
| 101 |
+
```
|
| 102 |
+
boy in forest
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
### Output:
|
| 106 |
+
|
| 107 |
+
```
|
| 108 |
+
A cinematic scene of a young boy standing in a dense forest, soft sunlight filtering through tall trees, atmospheric fog, ultra-detailed, 4k, depth of field, masterpiece
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
---
|
| 112 |
+
|
| 113 |
+
## ๐ Project Structure
|
| 114 |
+
|
| 115 |
+
```
|
| 116 |
+
project/
|
| 117 |
+
โ
|
| 118 |
+
โโโ app.py
|
| 119 |
+
โโโ requirements.txt
|
| 120 |
+
โโโ README.md
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
## โ๏ธ Core Functions
|
| 126 |
+
|
| 127 |
+
* `text_to_prompt()`
|
| 128 |
+
* `image_text_to_prompt()`
|
| 129 |
+
* `audio_to_prompt()`
|
| 130 |
+
* `generate_universal_prompt()`
|
| 131 |
+
|
| 132 |
+
---
|
| 133 |
+
|
| 134 |
+
## โ ๏ธ Limitations
|
| 135 |
+
|
| 136 |
+
* Requires GPU for best performance
|
| 137 |
+
* Video input not supported (yet)
|
| 138 |
+
* Output quality depends on prompt instruction
|
| 139 |
+
|
| 140 |
---
|
| 141 |
|
| 142 |
+
## ๐ฎ Future Improvements
|
| 143 |
+
|
| 144 |
+
* ๐ฅ Video input support
|
| 145 |
+
* ๐จ Style selection (anime, cinematic, realistic)
|
| 146 |
+
* ๐ Prompt scoring system
|
| 147 |
+
* โ๏ธ Deployment on HuggingFace Spaces
|
| 148 |
+
|
| 149 |
+
---
|
| 150 |
+
|
| 151 |
+
## ๐ค Contributing
|
| 152 |
+
|
| 153 |
+
Pull requests are welcome!
|
| 154 |
+
For major changes, please open an issue first.
|
| 155 |
+
|
| 156 |
+
---
|
| 157 |
+
|
| 158 |
+
## ๐ License
|
| 159 |
+
|
| 160 |
+
This project is open-source under the MIT License.
|
| 161 |
+
|
| 162 |
+
---
|
| 163 |
+
|
| 164 |
+
## ๐จโ๐ป Author
|
| 165 |
+
|
| 166 |
+
**Anshu Singh**
|
| 167 |
+
|
| 168 |
+
---
|
| 169 |
+
|
| 170 |
+
## โญ If you like this project
|
| 171 |
+
|
| 172 |
+
Give it a โญ on GitHub!
|
| 173 |
+
|