This project is a microservice-based NLP application that generates creative stories from a given topic and narrates them using text-to-speech. It includes:
- FastAPI REST endpoint (
/generate) - gRPC endpoint for high-performance interservice calls
- Text generation using Databricks/dolly v2
- TTS audio synthesis
- Tests for both REST and gRPC interfaces
- Gradio UI + Postman testing
- Dockerized for easy deployment
- gRPC + FastAPI microservices
- Async concurrency and parallel request handling
- Error handling for invalid topics and internal issues
- Streaming and downloadable audio output
- Unit tests for REST and gRPC interfaces
- Frontend UI with Gradio
- Dockerized Deployment
pip install -r requirements.txtKey packages:
transformerstorchfastapiuvicorngradiogrpciogrpcio-toolspydanticrequestsedge-ttsuuidasyncio
uvicorn app.main:app --reloadpython grpc_server.pypython tests/test_fastapi.py
python tests/test_grpc.pyOr run both via:
run_tests.batpython gradio_app.py{
"topic": "Apocalypse"
}Response:
{
"status": "success",
"story": "...",
"audio_file": "static/xyz.mp3"
}message StoryRequest {
string topic = 1;
}
message StoryReply {
string story = 1;
string audio_file = 2;
}docker build -t storygen-app .docker run -p 8000:8000 -p 50051:50051 storygen-appThe Gradio interface allows:
- Topic input
- Inline audio streaming
- Downloadable MP3 file
Created by Talha Syed — BS Artificial Intelligence (2025) Course: Fundamentals of NLP (AI4001 / CS4063)
This project is academic-only and for educational use.