How azizdeveci/lstm-text-generation works
This is a Turkish next-word prediction and text-generation application: users enter a seed phrase and requested word count, then receive generated text through a FastAPI endpoint. The runtime path runs from the browser interface through the API route to the LSTM service, which tokenizes the prompt and repeatedly predicts the next word. A separate training stage builds the model from the sentence corpus. The README also describes Swagger and CORS capabilities; their wiring is visible in the app entry point. The template itself was not sampled, so the browser-to-endpoint interaction follows the README’s description.
Main entry points: main.py FastAPI app · text_generation.py Generation endpoint · lstm_service.py LSTM inference · train_lstm.py Model training
Components 12
Web interface
- Generator page
app/templates/index.html - Interface styles
app/static/style.css
API
- FastAPI app
app/main.py - Generation endpoint
app/routes/text_generation.py - Text request
app/models/text_request.py - Swagger docs
app/main.py - CORS middleware
app/main.py
Text generation
- LSTM inference
app/services/lstm_service.py
Model training
- Sentence corpus
data/sentences.txt - Model training
train_lstm.py
Other components
- Browser user
- Trained model
Connections 12
- Browser user → FastAPI app: opens app
- FastAPI app → Generator page: renders page
- Generator page → Interface styles: uses styles
- Browser user → Generation endpoint: submits prompt
- Generation endpoint → Text request: validates input
- Generation endpoint → LSTM inference: requests generation
- LSTM inference → Sentence corpus: reads sentences
- LSTM inference → Trained model: loads model
- Model training → Sentence corpus: reads sentences
- Model training → Trained model: trains and saves
- Browser user → Swagger docs: views API docs
- FastAPI app → CORS middleware: configures