How neonc0wboy/rap works
Project Type and Purpose
• This is an open-source text-generation tool for creating Russian rap lyrics.
• It uses a GPU-backed inference service (hosted via a Jupyter notebook in GPU.ipynb) and various seed-phrase files to drive prompt generation.
• It also includes translation utilities (shell/PHP) and a lightweight web/CLI interface (HTML, JS, Python).
File-Structure Analysis
• Top-level scripts and folders:
• GPU.ipynb / GPU.txt – Jupyter notebook for spinning up the inference service on Colab.
• TextGen.py – Python CLI client that reads seed data, constructs prompts, and calls the inference API.
• api/ and api1/ – folders that may contain HTTP handler code or auxiliary API logic.
• php/ & php.php – a PHP-based translator microservice used by translate.sh.
• index.html / index.js – a simple static web UI that can invoke TextGen.py or the inference API directly.
• seed-related files: seeds.b39, RapSeedBIP39, wordlist.txt, wrus.txt, cipherseeds/, seeds/ – data stores for seed phrases and word lists.
• scr.sh / script.sh / translate.sh – shell wrappers that orchestrate translation calls, prompt formatting, and launching TextGen.py.
• package.json – contains Node.js dependencies, likely for the index.js UI or auxiliary scripts.
README Insights
• Instructs running GPU.ipynb first, copying the provided host URL into TextGen.py.
• Demonstrates CLI usage of “api” command and translate.sh to generate and translate rap lyrics.
• Relies on GPT-3.5-turbo (or similar) via an HTTP endpoint exposed by the notebook.
Main Components
A. Inference Service (GPU)
• A Jupyter Notebook (GPU.ipynb) deployed on Colab.
• Exposes an HTTP endpoint for text generation (host URL).
B. Client Layer
• TextGen.py: reads seed files → formats a JSON payload → sends HTTP request → receives generated lyrics.
• translate.sh + php/php.php: takes generated text → sends to PHP translator → returns Russian translation.
• Optional Web UI (index.html + index.js): static page that calls TextGen.py or directly hits the inference endpoint (using package.json’s Node.js server if present).
C. Data Store
• Local seed files: seeds.b39, RapSeedBIP39, wordlist.txt, wrus.txt, cipherseeds/, etc.
• Used by TextGen.py to craft prompts and by translation scripts as input.
D. Orchestration Scripts
• scr.sh / script.sh: automate the sequence (start notebook, inject host, run TextGen.py, run translation).
Relationships and Data Flows
• The orchestration script launches the GPU notebook or connects to it.
• TextGen.py reads seed files → constructs prompt → HTTP POST to GPU endpoint → receives lyrics.
• translate.sh calls php/php.php with the generated text → returns translated output.
• The Web UI (if used) issues the same HTTP requests to either TextGen.py or directly to the GPU endpoint.
• All components may log to script.log or nohup.out for debugging/tracing.
Architectural Patterns & Design Principles
• Separation of Concerns:
• Inference service (model hosting) is decoupled from the prompt-generation client.
• Translation logic is isolated in a small PHP microservice.
• Seed data is externalized in flat files for easy swapping/extensibility.
• Microservice-like boundaries: each major function (inference, translation, web UI) lives in its own folder.
• Shell orchestration for reproducible workflows.