This is a student project that was created for traditional Japanese haiku poems generation in response to user-defined themes โ with translations and authentic Ukiyo-e style illustrations. The main aim was to wrap up some knowledge obtained during โLangChain for LLM Application Developmentโ AI Course and practice project architecture building.
It was decided to pick a cohere LLM model for it has an intuitively clear and coherent API. Moreover, the model demonstrates great results in creativity and handles both Russian and Japanese text generation really well.
- ๐๏ธ Haiku Generator (in Japanese) using Cohere language models
- ๐ Automatic Russian Translation of generated haiku
- ๐ผ๏ธ Ukiyo-e Style Image Generation via Stable-Diffusion 3.5 large
- ๐ง Theme validation with simple heuristics
- โจ Minimalistic Streamlit UI
- ๐ Modular, extensible project structure
Input Theme: ะขะฐะฝะฐะฑะฐัะฐ
Generated Haiku (ๆฅๆฌ่ช):
ๆใ ไบคใใ
ๅคใฎๅคใซใใชใฐใใฎ
ๅคขๆใไบบ
Russian Translation:
ะะฒัะทะดั ะฟะตัะตะฟะปะตัะฐัััั
ะ ะปะตัะฝะตะน ะฝะพัะธ, ะขะฐะฝะฐะฑะฐัะฐ
ะัะดะธ ัะธัััั ะผะตััั.
Generated Image:
| Tech | Description |
|---|---|
| ๐ Python 3.10+ | Core language |
| ๐ Streamlit | Frontend web app |
| ๐ง Cohere | Haiku generation & translation |
| ๐จ Hugging Face API | stable-diffusion 3.5 large image generation |
| ๐ฆ dotenv | Local API token management |
git clone https://github.com/yourusername/haiku-generator.git
cd haiku-generator
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txtCreate an .env file in the root directory containing the paramount API keys:
COHERE_API_KEY='your_cohere_key'
HF_TOKEN='your_huggingface_token'
streamlit run app.pyhaiku-generator/
โโโ app.py -> Streamlit app entry point
โโโ haiku_generator.py -> Japanese haiku generation (Cohere)
โโโ russian_translation.py -> Poetic Russian translation
โโโ ukiyo_e_generator.py -> Image generation (stable-diffusion 3.5 large)
โโโ theme_validation.py -> Theme quality checker
โโโ requirements.txt
โโโ .env
A Cohere API is geo-blocked in certain regions, like Russia. So if its implementation is unavailable in your region consider using a foreign server or a VPN software.
